Kotest ver.
testImplementation(platform("io.kotest:kotest-bom:5.8.0"))
testImplementation("io.kotest.extensions:kotest-extensions-spring:1.1.3")
testImplementation("io.kotest:kotest-assertions-core")
testImplementation("io.kotest:kotest-assertions-json-jvm")
testImplementation("io.kotest:kotest-runner-junit5-jvm")
testImplementation("io.kotest:kotest-framework-datatest")
testImplementation("io.kotest:kotest-property")
I got a test class with custom tag BEAVER. When i try to run
./gradlew test -Dkotest.tags="BEAVER" all test are fired (even without the tag).
example ./gradle test -Dkotest.tags="Linux & !Database" returns error zsh: event not found: Database (MacOS)
object BEAVER: Tag()
class TagPlaygroundTest: StringSpec({
tags(BEAVER)
"should pass with tag".config(tags = setOf(BEAVER)) {
3 shouldBe 3
}
"should fail with tag".config(tags = setOf(BEAVER)) {
3 shouldBe 4
}
})
I want to run only tagged tests by using either ./gradlew or custom gradle tasks
The reason why that doesn't work is that
-Dproperties are supplied togradle/gradlewand Gradle doesn't know it has to propagate them to Kotest. You need to change yourbuild.gradleorbuild.gradle.ktsfile for Gradle to forward those properties to Kotest.From the Kotest documentation: