I've got the following configuration in my build.gradle.kts
:
tasks.withType<Test>().configureEach {
testLogging {
events = setOf(PASSED, SKIPPED, FAILED)
}
}
My Kotest tests are similar to these:
class MyTests : StringSpec({
"should fail" {
1 shouldBe 2
}
"should skip".config(enabled = false) {}
"should pass" {
1 shouldBe 1
}
})
However when I run ./gradlew test --info
, I can see in the output the first two tests reported as FAILED and SKIPPED accordingly, but the last one is not reported at all, while I'd expect it to be so as PASSED.
Am I doing something wrong or is it a missing feature?
Please find the complete example here.
The test result is being reported, you can see the output of tests completed:
3 tests completed, 1 failed, 1 skipped
However, what's happening, when you add the --info
flag, you're scoping the logging to INFO
, in which the event SUCCESS
is not set to INFO
.
To amend this, you can configure your Gradle test task to add PASSED
to INFO
events:
tasks.withType<Test>().configureEach {
testLogging {
with(setOf(PASSED, SKIPPED, FAILED)) {
events = this
info.events = this
}
}
useJUnitPlatform()
}