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

José González Gómez

05/03/2021, 7:45 AM
Is it possible to use
kotest
in a Kotlin Multiplatform Mobile project? I have included the following dependencies in the shared project:
Copy code
val kotestVersion = "4.4.0"
kotlin {
    sourceSets {
        val commonTest by getting {
            dependencies {
                implementation("io.kotest:kotest-runner-junit5:$kotestVersion")
                implementation("io.kotest:kotest-assertions-core:$kotestVersion")
                implementation("io.kotest:kotest-property:$kotestVersion")
            }
        }
    }
}
but this fails when trying to build the project because there is no
ios_x64
variant of
kotest-runner-junit5
. Android Studio fails while reloading the project trying to find
kotest-runner-junit5-4.4.0-samplessources.jar
and
./gradlew build
explicitly fails due to the missing
ios_x64
variant not found.
t

thanksforallthefish

05/03/2021, 7:56 AM
junit is jvm only I think. other than that, I did not try kotest in multiplatform so cannot help more
j

José González Gómez

05/03/2021, 7:57 AM
yes, I've been googling about this and you are right,
kotest-runner-junit5
is jvm only 😞
m

MiSikora

05/03/2021, 7:58 AM
This requires native support to make framework work. You can use assertions and property testing though. https://github.com/kotest/kotest/issues/1743
j

José González Gómez

05/03/2021, 8:03 AM
Ok, but then I guess you lose the possibility of writing tests using the styles provided by
kotest
and you must stick to Kotlin Test style using
@Test
annotation, am I right? https://kotlinlang.org/docs/mpp-run-tests.html#test-shared-code
m

MiSikora

05/03/2021, 8:04 AM
Yes, that’s what kotest framework provides. Specification style testing.
j

José González Gómez

05/03/2021, 8:04 AM
ok, thank you very much!
s

sam

05/03/2021, 12:17 PM
Kotest framework works on javascript too.
4 Views