Kotlin JUnit tests report is missing

I am using SonarQube 7.3, Kotlin plugin 1.2.1 (and JaCoCo plugin 1.0.1 if that’s relevant.) I’ve managed to get my project analyzed, I can see coverage, but tests number and report is missing. XML reports are generated by Gradle as expected in /build/test-results/test/TEST-*.xml. Am I missing anything? How should I set it up? Thanks.

3 Likes

Hello Mike,

Nothing is missing on your side. We decided it was not a priority to be able to load the UT results for the moment for Kotlin code, so the feature is not there.

Can you confirm you expect to be able to load JUnit Test Results XML format for your Kotlin project?

Thanks

Yes, that’s correct. You’re right it’s not a priority since usually tests must pass anyway to get the build done, but it might be useful to track the number in accordance to some other metric available. Since Java has it and the format is the same, maybe it wouldn’t be that difficult to implement the same for Kotlin.

I agree with you, technically speaking there is no problem because it’s just a matter of removing a constraint to accept all languages and not just Java as it is the case today for the property sonar.junit.reportPaths
Then the question is where do we put this feature? Shall we keep it in SonarJava, I don’t think so. I would prefer this to have this kind of feature coming out of the box with SonarQube, ie not linked to any analyzer.

You may be right. Since the file in this format can be used for at least two language it make sense. Either way, currently it is missing when analyzing Kotlin project, that’s why I wrote the post. Not sure I could add anything else. I guess, decision is up to the team how to implement it.

FYI I created this ticket to track the request https://jira.sonarsource.com/browse/SONARSLANG-353

1 Like

Small correction. The source code of tested code should be java. The source code of the test is not important.

As soon as we switched from Detekt to Sonar plugin we lost majority of coverage. And we have all tests in Kotlin now.

We are in the same limitation, we expect from sonar to track:

  • code coverage (ok for kotlin and java)
  • test case count (that may be in java or kotlin) to either test java or kotlin.

We are on a android project, and this limitation doesn’t make any sens for android cases. Do you have some update or plan to enable it ?

2 Likes

Please upvote this issue for a faster resolution

Guys, kotlin adoption is mature already.
Can we get update for this case ASAP?

Thank you