called B (and I already have one called A). B needs some of the code that exists in A, so I thought I would create a new Kotlin source set for the shared code and depend on it from both B and A, but I'm having trouble expressing this in gradle's Kotlin DSL..
Emil Kantis
09/10/2024, 12:33 PM
I'm putting the shared code into a shared source set called
testUtils
, which is created as such:
Copy code
val testUtils by kotlin.sourceSets.creating {
kotlin.srcDir("src/testUtils/kotlin")
dependencies {
// ....
}
}
Emil Kantis
09/10/2024, 12:38 PM
I tried adding it to the
JvmTestSuite
with:
Copy code
testing {
suites {
val integrationTest by registering(JvmTestSuite::class) {
dependencies {
implementation(sourceSets["testUtils"].output)
}
}
}
}
but this gives a null pointer
a
Adam S
09/10/2024, 3:31 PM
Is the project a Kotlin/JVM project? If so, I recommend using java-test-fixtures to share test utilities instead of custom wiring of sources.
e
Emil Kantis
09/10/2024, 3:32 PM
It is. Ill have a look at that, thanks 🙂
Emil Kantis
09/23/2024, 4:42 PM
Turns out that created new issues due to the code shared between integration-testing suites caused unit-tests to fail due to classpath pollution...