georgi
01/13/2022, 9:16 PM./gradlew connectedAndroidTest where my shared module unit tests inside src/commonTest/kotlin also run as part of the Android instrumented tests. Anyone experienced this before? 🤔 More details in 🧵georgi
01/13/2022, 9:20 PMshared/src/commonTest/kotlin and a few android instrumented tests which are under app/src/androidTest of the Android app.
If I run ./gradlew test only the unit tests run which is correct.mkrussel
01/13/2022, 9:22 PMcommonTest is added to all the test source sets including the instrumented tests.
I created a new module for my instrumented tests but that really wasn't the best solution. Probably would have been better to remove commonTest/kotlin from the android test source set.georgi
01/13/2022, 9:26 PMinteresting, is there some reading I could look into related to this? Sounds like I might have missed itis added to all the test source sets including the instrumented testscommonTest
I created a new module for my instrumented testsI kind of have multiple feature modules on Android each with their own instrumented tests so I think removing
commonTest/kotlin from the android test source set could be the way to gomkrussel
01/13/2022, 9:27 PMgeorgi
01/13/2022, 9:28 PMmkrussel
01/13/2022, 9:29 PMgeorgi
01/15/2022, 10:49 PMcommonTest running as part of the instrumentation tests - apparently it's meant to since it's part of the common KMM code.
Rather, my issue was that the connectedAndroidTest was actually throwing a silent exception related to a missing testInstrumentationRunner on the KMM side. As soon as I added:
android {
defaultConfig {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
}
and
val androidAndroidTest by getting {
dependencies {
implementation("androidx.test:runner:1.4.0")
}
}
commonTest started to run with no exceptions during connectedAndroidTest 🎉