I have a Quarkus project that has both a test
sources folder and a native-test
folder. The guidance seems to be that I would have a lot of the same tests (specifically @QuarkusIntegrationTest
s) in the native-test
folder. Is there a way to specify to use the same source set in test
as native-test
?
It makes sense that one might want to have different tests in the other source-set, but it seems tedious to me to have to keep track of the same tests between the two source-sets. Is there a way to tell the nativeTest
task to use the tests from the test
source set? Is that what I want? Am I visuallizing the purposes of these tests correctly?
I have assumed I could set up in Gradle a bit of script to copy in relevant tests to the native-test
directories when testNative
runs but this feels quite hacky.
CodePudding user response:
The nativeTest
task inherits from the Test
task, so you should be able to configure it as the test
task.
A problem you may face is that gradle test
will run @QuarkusIntegrationTest
with the default packaging (this may take time).
gradle nativeTest
will run all tests event the @QuarkusTest
.
Using include
/ exclude
in task configuration may lead to what you want:
nativeTest {
testClassesDirs = project.sourceSets.nativeTest.output.classesDirs
include '**/it/*'
}
test {
exclude '**/it/*'
}
gradle test
will run all tests from src/test/java
excepts tests in the it
package.
gradle nativeTest
will only run test from src/test/java
located in the it
package.