So jetbrain's super amazing kmp plugin includes ab...
# kotest
v
So jetbrain's super amazing kmp plugin includes absolutely zero test setup. Include tests so that all developers can be encouraged to write well made code? Jetbrains would rather just give you a ktor server. This means I have to try and set up kotest on my own without a common test. It does not seem to work so I am reaching out for some help. Let me show you what I did first I added this in the build.gradle in the sourceSets section
Copy code
val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
                implementation("io.kotest:kotest-assertions-core:${project.property("kotest-assertions-version")}")
                implementation("io.kotest:kotest-framework-engine:${project.property("kotest-assertions-version")}")
            }
        }
I then created the commonTest directory under the src folder so it looks like the included image. I also created a class called DatabaseTest. Then I wrote this test
Copy code
class DatabaseTest : FreeSpec() {

    init {

        "test" {
            0 shouldBe 0
            fail("ssp")
        }


    }


}
Doing ./gradlew test shows successful which means its not running the test. Running the test through the kotest plugin gives me this error
Copy code
Cannot locate tasks that match ':composeApp:compileJava' as task 'compileJava' is ambiguous in project ':composeApp'. Candidates are: 'compileDebugAndroidTestJavaWithJavac', 'compileDebugJavaWithJavac', 'compileDebugUnitTestJavaWithJavac', 'compileReleaseJavaWithJavac', 'compileReleaseUnitTestJavaWithJavac'.
Any clue on how to solve this annoyance?
d
For JVM, you need to import
io.kotest:kotest-runner-junit5:$version
in JvmTest module
Copy code
val jvmTest by getting {
            dependencies {
                implementation("io.kotest:kotest-runner-junit5:$version")
            }
        }
$version
is the kotest version of course
v
do i need to import different things per platform?
d
just for JVM
For Common & Native, the dependencies in commonTest added are enough
v
What about android
d
hum .. probably same than JVM
v
Ok ill try that after work today thanks
I still have the same problems and I think i got the dependancies sorted. It may be Intellij being weird thought intellij seldom does this type of stuff