Some files doesn't show code coverage while they should

I’m working on a Kotlin project and I’m writing tests. But for some files code coverage is not showing in SonarCloud.
What I have done:

  • Write a test for a class to test all the functions.
  • In IntelliJ I 100% code coverage for the class that I’m testing.
  • When I run ./gradlew jacocoTestReport I see 100% code coverage for the class that I’m testing.
  • When I run ./gradlew sonarqube I see 0% code coverage for the class that I’m testing. But for other classes I do see code coverage.

What is going on? Everything on my local machine looks like it’s working fine, but SonarCloud doesn’t show it.

Hi,

Can you show the logs of the analysis, properties of the analysis (sonar-project.properties) and report content?

Hi,

I already resolved it. Apparently there was some bug in the Sonar Gradle plugin and updating it resolved my issue.

Hi Peter,
I think I have similar issue as you. would you share how do you update gradle to fix this issue?