https://kotlinlang.org logo
#kotest
Title
# kotest
v

Vishnu Shrikar

11/13/2023, 7:21 AM
so I am running this command with kotest
Copy code
gradle desktopTest -DKotest.filter.specs='*' -DKotest.filter.tests='pass'
And am getting this output
Copy code
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
Copy code
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
        }

}
Here is my test class
Copy code
class DatabaseTest : FreeSpec() {



    private fun pass() = (0 shouldBe 0)
   


    init {

        "test" {
            pass()
            fail("ssp")
        }

        "pass" {
            pass()
        }


    }


}
What I want to do is simply run the "pass" test and nothing else
a

Adam S

11/13/2023, 10:37 AM
Are you using Powershell? Can you try wrapping the arg in quotes? https://github.com/gradle/gradle/issues/13541
v

Vishnu Shrikar

11/13/2023, 3:31 PM
this happens on WSL