Issue
I followed Florina Muntenescu`s article about room migration tests and after adding room testing in my gradle file I started to have this error when running my UI tests:
java.lang.ClassNotFoundException: Didn't find class
"br.com.jonathanzanella.TestRunner" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar",
zip file "/data/app/br.com.jonathanzanella.myexpenses.debug.test-1/base.apk",
zip file "/data/app/br.com.jonathanzanella.myexpenses.debug-1/base.apk"],
nativeLibraryDirectories=[/data/app/br.com.jonathanzanella.myexpenses.debug.test-1/lib/x86, /data/app/br.com.jonathanzanella.myexpenses.debug-1/lib/x86, /vendor/lib, /system/lib]]
I am using room and lifecycle observables from architecture components:
implementation "android.arch.lifecycle:extensions:$roomVersion"
implementation "android.arch.persistence.room:runtime:$roomVersion"
implementation "android.arch.persistence.room:rxjava2:$roomVersion"
androidTestImplementation "android.arch.persistence.room:testing:$roomVersion"
kapt "android.arch.persistence.room:compiler:$roomVersion"
roomVersion is 1.0.0
I have a custom test runner:
testInstrumentationRunner 'br.com.jonathanzanella.TestRunner'
The TestRunner class is defined inside androidTest folder.
Looking this issue in facebook screenshot tests makes me think that the problem is that room testing also defines a customRunner and I need to override it as showed in the issue solution, but the code
project.app.customTestRunner = true
Doesn't compile for me
Solution
Digging here at stack overflow I found this question that made my think that the error could be something else.
Since room has a compiler that I need to add to kapt, I tried to add it as a dependency of kapt in androidTest was well and it fixed the problem.
The code that solved the issue is this:
kaptAndroidTest "android.arch.persistence.room:compiler:$roomVersion"
Answered By - jonathanrz
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.