Not able to run unit tests on kotlin Multiplatform project

Hi all,

I am trying to create a kotlin Multiplatform library which can later convert into java and javascript using IDEA 2019.3, kotlin 1.3 .

I created a simple junit (4) test class and configured it as follows.

package sample;
import org.junit.Test;

public class Tests {
    public void test1(){


But while running, it’s failing with

Process finished with exit code 1 Class not found: “sample.DummyTest”

I could not figure out what am I doing wrong. Please advice.

Do your tests run on the CLI through Gradle? If so, read on.

In addition to all the things found in the docs, I discovered that – even for JVM-only projects! – two dependencies are needed for IDEA to run the tests:

dependencies {
    compileOnly("org.jetbrains", "annotations", "18.0.0")

    testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine", "5.5.2")

    // IDEA needs those:
    testCompileOnly("org.junit.jupiter", "junit-jupiter-api", "5.5.2")
    testCompileOnly("org.junit.jupiter", "junit-jupiter-params", "5.5.2")

That said, I think I observed no tests being found; your problem seems to be different. If so, my bad.

Thanks for the reply.
I was trying to running it via IDEA itself. Right click on a test -> then Run TestName…

Try to delete the created Junit run configuration and create a Gradle one (build and run tests using Gradle in “File | Settings | Build, Execution, Deployment | Build Tools | Gradle”). Does this help?

Thanks for the reply. But it did not help.
I deleted the created Junit run configuration and created a Gradle one.

Then I rightClick on jvm class and pressed run. But it failed with following exception.
Just to note my tests are still annotated with junit.

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':jvmTest'.

> No tests found for given includes: [mypackage.TestSample](filter.includeTestsMatching)

If you have a multi-module MPP project, it’s probably this bug: Please check the generated run configuration, it might be missing the correct Gradle project value as described in the issue. This is only a problem when running tests from gutter, ie. running jvmTest task from the Gradle tool window in IDEA should work fine.

@Alexey.Belkov as far as I understood is talking about multi module multi platform project. Mine is single multiplatform project.
In the javaTest, I wrote another Testfile( A.kt)with kotlin.test.Test annotation and that runs.
But java test file (*.java) is not running