Kotlin tests not recognised in an Android environment


(Nielsz) #1

I’m running an Android project, that has most of its code and tests written in Kotlin.
Now everything is placed in src/main/java and src/test/java (as opposed to src/main/kotlin).

Sonarcloud correctly picks up all the Kotlin classes in src/main/java, but it doesn’t pick up the Kotlin unit tests in src/test/java.
I’ve added a Java unit test, and it picks it up nicely, but when I make one in Kotlin it’s not showing, not in the Code tab, nor in the Unit Tests widget on the project homepage.

My setup:

    property "sonar.sources", "src/main/java"

    property "sonar.tests", "src/test/java"

    property "sonar.junit.reportPaths", "build/test-results/testDebugUnitTest"

The XML files in testDebugUnitTest folder do present the correct XML files, so that’s generated OK.

(Benoit) #2


This thread might help: Kotlin JUnit tests report is missing