Slackbot
09/01/2022, 9:20 PMVampire
09/01/2022, 9:38 PMtestImplementation
are also available to integrationTestImplementation
and that integrationTestImplementation
dependends on project
.
What you miss is a dependency from integrationTestImplementation
to the test classes.
But actually I'd suggest you instead add the java-test-fixtures
plugin to the mix and put the shared classes into the test fixtures source set, then depend on that from test and integrationTest.Michal Kubele
09/01/2022, 11:34 PMjava-test-fixtures
and it solved almost all my issues, but I’ve encountered strange NPE I have no idea how to fix:
I’m accessing file from resource this way:
val file = File(javaClass.getResource("/folder/file.txt").file)
but it crashes because of:
java.io.FileNotFoundException: file:/PATH/build/libs/APP.jar!/folder/file.txt (No such file or directory)
but when I unzip the jar, the file is there on correct path.
There was no issue with it when it was directly in the test/resources folderVampire
09/01/2022, 11:40 PMMichal Kubele
09/02/2022, 7:26 PMtestFixtures
, even the basic contextLoads()
test fails, because it can’t find the certificates - it seems the main/resources is no longer accessible. I tried something like this:
sourceSets {
testFixtures {
resources {
setSrcDirs(listOf("src/main/resources"))
}
}
}
or
java.sourceSets["testFixtures"].resources {
srcDir("src/main/resources")
}
but that didn’t help. I tried google and stackoveflow, but I wasn’t successful either. Is there a way how to propagate man/resources to the testFixtures
?Vampire
09/02/2022, 9:04 PM