#kotest
Title
# kotest
l

Lukasz Kalnik

02/22/2022, 8:41 AM
I'm getting Engine exception when trying to run Kotest tests on JVM:
Copy code
LightColorTemperatureViewModelKotest has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Module Gradle JDK configuration:
Copy code
compileOptions {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions.jvmTarget = JavaVersion.VERSION_11.toString()

tasks.withType(Test::class.java) { testTask ->
    testTask.useJUnitPlatform()
}
Copy code
val kotestVersion = "5.1.0"
    testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")
    testImplementation("io.kotest:kotest-property:$kotestVersion")
    testImplementation("io.kotest.extensions:kotest-extensions-koin:1.1.0")
Ok, as the tests didn't work when running from Android Studio "Run test" button, but ran from the command line, the culprit was the default Kotest run configuration template which was configured to use JRE 8 from one of the Android SDKs.
I have changed it now to JDK 11 and tests work from Android Studio:
👍🏻 1
558 Views