Mykola Gurov
03/17/2022, 4:06 PMintegration
, e2e
, `contract`; no tag == unit test) and executed in separate jobs on CI (gradle).Mykola Gurov
03/17/2022, 4:06 PMimport org.junit.jupiter.api.Tag
@Tag("integration")
class KotestIT(): FuncSpec({
...
})
but that doesn’t seem to be working out of the box ( kotest 5.2.1 ), and the following command doesn’t pick this test:
./gradlew test \
-DincludeTestTags='integration & !e2e & !contract' \
--tests my.example.KotestIT
Mykola Gurov
03/17/2022, 4:07 PMval Integration = NamedTag("integration")
@Tag("integration")
class KotestIT(): FuncSpec({
tags(Integration)
})
./gradlew test \
-Dkotest.tags='integration & !e2e & !contract' \
--tests my.example.KotestIT
✅
But…Mykola Gurov
03/17/2022, 4:08 PM./gradlew test \
-DincludeTestTags='integration & !e2e & !contract' \
-Dkotest.tags='integration & !e2e & !contract' \
--tests my.example.KotestIT
Looks like kotest-runner-junit5 doesn’t propagate the @Tag("integration")
, and the test is skipped:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> No tests found for given includes: [my.example.KotestIT](--tests filter)
Mykola Gurov
03/17/2022, 4:08 PMMykola Gurov
03/17/2022, 4:09 PMsam
03/18/2022, 8:34 PMMykola Gurov
03/20/2022, 8:36 PMintegration
in my examples - both for JUnit and Kotest. Are you saying that you’d expect that to work? I got a feeling, the kotlin test is filtered out by the junit runner before the kotest tags can get into the play.sam
03/20/2022, 8:49 PMMykola Gurov
03/20/2022, 9:00 PMval Integration = NamedTag("integration")
@Tag("integration")
class KotestIT(): FuncSpec({
tags(Integration)
})
sam
03/20/2022, 9:01 PMsam
03/20/2022, 9:01 PMMykola Gurov
03/20/2022, 9:01 PMsam
03/20/2022, 9:01 PMMykola Gurov
03/20/2022, 9:01 PMimport org.junit.jupiter.api.Tag
sam
03/20/2022, 9:01 PMtasks.withType<Test> {
useJUnitPlatform()
filter {
isFailOnNoMatchingTests = false
}
Mykola Gurov
03/20/2022, 9:02 PMsam
03/20/2022, 9:03 PMMykola Gurov
03/20/2022, 9:03 PMMykola Gurov
03/20/2022, 9:33 PMfilter {
isFailOnNoMatchingTests = false
}
doesn’t help much - the build isn’t failing, but this time with 0 tests executed.
> Task :test
SUCCESS: Executed 0 tests in 7.4s
sam
03/20/2022, 9:35 PMsam
03/20/2022, 9:35 PMMykola Gurov
03/20/2022, 9:37 PMMykola Gurov
03/21/2022, 7:42 AMMykola Gurov
03/21/2022, 7:46 AMincludeTags = setOf("none()")
, and not with includeTags = setOf("integration")
import io.kotest.core.annotation.Tags
@Tags("integration")
@org.junit.jupiter.api.Tag("integration")
class KotestIT : StringSpec({
tags(NamedTag("integration"))
...
})