Some files doesn't show code coverage while they should

kotlin
gradle
(Peter Fortuin) #1

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.