Grzegorz Gajewski
11/30/2023, 7:20 PMapplyDefaultHierarchyTemplate {
withSourceSetTree(
KotlinSourceSetTree.Companion.main,
KotlinSourceSetTree.Companion.test,
KotlinSourceSetTree.Companion.instrumentedTest
)
}
Adding instrumentation test like this:
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach {
val instrumentedTest by it.compilations.creating {
associateWith(it.compilations.getByName("main"))
}
}
This creates commonInstrumentation
source sets
Then in sourceSets I’m setting the dependency for androidInstrumentedTest
sourceSets {
val commonInstrumentedTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val androidInstrumentedTest by getting {
dependencies {
implementation("androidx.test:runner:1.5.2")
}
dependsOn(commonInstrumentedTest)
}
}
When I try to run it I have “Nothing here” and ./gradlew alltest
doesn’t run it either.
Looks like is commonInstrumentedTest
and iosInstrumentedTest
are not recognized as test sources.Grzegorz Gajewski
12/01/2023, 6:20 PMiosSimulatorArm64 {
val instrumentedTest by compilations.creating {
associateWith(compilations.getByName("main"))
}
binaries.test("instrumented") {
compilation = instrumentedTest
}
testRuns.create("instrumented") {
setExecutionSourceFrom(binaries.getTest("instrumented", NativeBuildType.DEBUG))
}
}
It still doesn’t work in IDE. Maybe connected to KTIJ-25662