Hantsy Bai
04/12/2024, 8:47 AMval integrationTest = task<Test>("integrationTest") {
description = "Runs integration tests."
group = "verification"
// testClassesDirs = sourceSets["intTest"].output.classesDirs
// classpath = sourceSets["intTest"].runtimeClasspath
// shouldRunAfter("test")
useJUnitPlatform{
filter {
include("**/*IT.class")
}
}
}
tasks.check{
dependsOn(integrationTest)
}
I have modified the integration test classes with a IT
postfix. I have used includes(**/*IT.class)
or includeTestsMatching("*IT")
, it does not work when run ./gradlew clean intergrationTest
. All tests are run as before.
Any suggestion here?Niels Doucet
04/12/2024, 9:05 AMVampire
04/12/2024, 9:31 AMfilter
in useJUnitPlatform
does not make much sense, that is just visual clutter as filter
is a method on the Test
task directly.
Nesting include
in filter
does not make much sense, that is just visual clutter as include
is a method on the Test
task directly.
So what you shows is the same as
useJUnitPlatform()
include("**/*IT.class")
Both the options you showed should imho work though.
Can you maybe knit an MCVE that demoes the problem?
Btw. you should not use task("...")
as that is an eager api and not leveraging task-configuration avoidance. You can easily see this from the return type being the concrete task and not some provider.Hantsy Bai
04/15/2024, 3:58 AMtasks.register
instead. But the filter in integrationTest still does not work as expected, it still includes all tests in the integrationTest
task, although I have moved the filter out of useJunitPlatform
.Hantsy Bai
04/15/2024, 4:33 AMtest
task. I have to exclude the tests defined in the test filter.