I’m having trouble defining a test sources only module in my multi-module project.
Say that I have the following structure:
gradle-example:
app:
src/main/kotlin (regular production code)
src/test/kotlin <- this is supposed to use 'com.example.SomeTestUtil'
testlib:
src/test/kotlin/com.example.SomeTestUtil
I would like to have various test utilities in the testlib
module under src/test
, and to be able to use them in the app
module, but only in src/test
. I know i can move the SomeTestUtil
from src/test
to src/main
and just use it in the tests, but I would like to avoid having these classes exposed to production code.
Is it possible to do that ?
Current app
module build.gradle.kts
has:
dependencies {
testImplementation(project("testlib"))
}
But it does not work and I cannot import the SomeTestUtil
to app src/test