mardi 26 juin 2018

Running multi platform Kotlin test in IntelliJ produces No JDK specified error

I have several tests in common module for multi platform Kotlin project. When I execute those tests using gradle, e.g. ./gradlew :android:test, they all go through and the tests run.

I have now encountered a more complicated problem where I would like to debug an actual test in IntelliJ. Unfortunately, upon selecting the debug option in IntelliJ, I get an No JDK specified error.

No JDK specified

I am using the following dependencies for testing:

testImplementation "org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlin_version"
testImplementation "org.jetbrains.kotlin:kotlin-test-common:$kotlin_version"

with $kotlin_version being 1.2.41.

The common module settings looks like this:

Common module settings

SDKs section also correctly recognises JDKs:

SDKs

I have tried changing the Module SDK from Kotlin SDK to java, however IntelliJ then wants me to require jUnit for test execution, which I would prefer not to, if possible.

Is there a way how to make the debugger run in IntelliJ for the Kotlin code?

Aucun commentaire:

Enregistrer un commentaire