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

dave08

10/10/2023, 2:49 PM
Trying out Fleet IDE now a bit, but again, missing an important thing: running Kotest tests... how can I run a particular test using gradle test task? What are my options? Is there any docs for this?
o

Oliver.O

10/10/2023, 2:54 PM
You could use test filtering in your Gradle build script like so:
Copy code
tasks.withType<Test>().configureEach {
    useJUnitPlatform()
    filter {
        listOf<String>(
             "serialization.CommonSerializationTests*",
             "serialization.JvmSerializationTests*",
        ).forEach {
            includeTestsMatching("${rootProject.name}.$it")
        }
    }
}
d

dave08

10/10/2023, 2:56 PM
For BDD, I need to run the test class I'm currently working on... it wouldn't be too practical to mangle with build.gradle.kts for this...
But I know the plugin does this, I just forgot the syntax and didn't find any docs on it...
o

Oliver.O

10/10/2023, 2:57 PM
I'm not using Fleet currently. Which plugin are you referring to?
d

dave08

10/10/2023, 2:57 PM
The intellij plugin for kotest.
I'm on EAP and it doesn't work there... nothing to do with Fleet
Fleet just has an option to run a gradle task, so I thought of just doing that, but I don't remember the syntax
o

Oliver.O

10/10/2023, 3:08 PM
You'll need the Kotest plugin to run a single test from the IDE without messing with build scripts or test sources (e.g. via the focus indicator "!"). Compatible IntelliJ versions are listed on the plugin marketplace, your EAP may be too new. AFAIK, Fleet doesn't support plugins so far. Maybe you could use the Gradle command line.
d

dave08

10/10/2023, 3:15 PM
That's what I was looking for, the command line, thanks!
👍 1
4 Views