Automation tests and reports in Kotlin + Junit5 + Maven are not recognized

Recently, I started designing a new Automation test infrastructure in Kotlin + Junit5 + Maven. (Regression tests)

  1. Test are properly run using the Intellij buttons, but it is not recognized by “mvn test”:
> *[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ CIQBE ---*
> *[INFO] No sources to compile*
> *[INFO] *
> *[INFO] --- kotlin-maven-plugin:1.7.20:test-compile (test-compile) @ CIQBE ---*
> *[WARNING] No sources found skipping Kotlin compile*
> *[INFO] *
> *[INFO] --- maven-surefire-plugin:3.0.0-M4:test (default-test) @ CIQBE ---*
> *[INFO] No tests to run.*
> *[INFO] ------------------------------------------------------------------------*
> *[INFO] BUILD SUCCESS*
> *[INFO] ------------------------------------------------------------------------*
  1. Using “mvn site” for reports upload, also shows “0” test. (Assuming affected by the same reason )

  2. My Project structure is different then default unit test structure. (See attached screenshot)
    I tried to override “testSourceDirectory” in pom file, but path was not affected:
    (also marked in screenshot)

<build>
    <testSourceDirectory>${project.basedir}/src/main/kotlin</testSourceDirectory>

Pom.xml:
<kotlin.version>1.7.20</kotlin.version>

Can you please guide me how Kotlin tests should be configured?

Screenshot 2022-11-27 230237


Problem is solved, using the following instructions:

1 Like