I migrated Android library modules to Kotlin Multiplatform gradle module, and now, the tests in
androidTest
are run as unit tests without instrumentation, making them fail (they are run on the computer without Android OS with no option to run it from an Android device/emulator).
Where should I put my instrumented tests, or how should I configure my module to get instrumentation back?
k
Kris Wong
03/03/2019, 7:34 PM
In order to have instrumented tests, you need to have an app target (apk). you can't run a library
❌ 1
b
bdeg
03/04/2019, 12:53 AM
You have to set the sourcesets, as test sets
l
louiscad
03/04/2019, 7:14 AM
Which source sets? How? Is there an example?
y
yshrsmz
03/04/2019, 8:14 AM
something like this
Copy code
android {
// min sdk and other android config
sourceSets {
androidTest.java.srcDirs += 'src/androidTest/kotlin'
}
}
l
louiscad
03/04/2019, 8:59 AM
Oh, that perfectly makes sense now! AGP still doesn't handle
kotlin
dir by default, and I removed it in the process of migrating to Kotlin multiplatform plugin. Thanks for the hint!
b
bdeg
03/04/2019, 12:59 PM
Welcome, sorry for the delay @louiscad.
Thanks @yshrsmz