Vishnu Shrikar
11/13/2023, 7:21 AMgradle desktopTest -DKotest.filter.specs='*' -DKotest.filter.tests='pass'
And am getting this output
Type-safe project accessors is an incubating feature.
[(kotest_filter_specs, *), (kotest_filter_tests, pass)]
> Task :composeApp:desktopTest
DatabaseTest[desktop] > test[desktop] FAILED
java.lang.AssertionError: ssp
at DatabaseTest$1.invokeSuspend(DatabaseTest.kt:44)
at DatabaseTest$1.invoke(DatabaseTest.kt)
at DatabaseTest$1.invoke(DatabaseTest.kt)
Caused by:
java.lang.AssertionError: ssp
at DatabaseTest$1.invokeSuspend(DatabaseTest.kt:44)
... 2 more
DatabaseTest[desktop] > pass[desktop] PASSED
2 tests completed, 1 failed
Here is my configuration
tasks.named<Test>("desktopTest") {
outputs.upToDateWhen { false }
useJUnitPlatform()
val specs: String? = System.getProperty("Kotest.filter.specs")
val tests: String? = System.getProperty("Kotest.filter.tests")
val specPair = specs.takeIf { it != null }?.let { ("kotest_filter_specs" to specs!!) }
val testPair = tests.takeIf { it != null }?.let { ("kotest_filter_tests" to tests!!) }
val pairs = listOfNotNull(
specPair,
testPair
)
println(pairs)
filter {
isFailOnNoMatchingTests = false
}
testLogging {
showExceptions = true
showStandardStreams = true
events = setOf(
org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED,
org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED
)
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}
class DatabaseTest : FreeSpec() {
private fun pass() = (0 shouldBe 0)
init {
"test" {
pass()
fail("ssp")
}
"pass" {
pass()
}
}
}
Adam S
11/13/2023, 10:37 AMVishnu Shrikar
11/13/2023, 3:31 PM