Some classes coverage cannot show on sonarqube

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube: 2.8
    Jacoco:0.8.5
  • what are you trying to achieve
    show all the test coverage on sonarqube
  • what have you tried so far to achieve this
    I am working on an Android project, I tried to push the coverage on sonarqube. However, there is a weird thing happen. I found that some of the classes can show it’s coverage on sonarqube, but some of them keep showing 0%, no matter how many unit test I added on it. I tried to see the android studio test coverage and the jacoco report in local, both are showing correct coverage level. But once on sonarqube it can’t show anymore. And for those correct coverage classes and incorrect coverage classes, them both are presenter classes and place under the same module and package. Anyone one can help on it? Thank you for your help.

Hi @henry.tung,

Please see our community guide here, JaCoCo coverage is 0% on SonarQube, and see if this helps you.

Joe

Hi Joe,
Thank you for your help first. However, I still can’t resolve my issue, I even read the JaCoCo import troubleshooting on SonarQube 60 guide too. since my case is just some classes showing 0% test coverage. It means I am getting the right file to sonarqube

Hi @henry.tung,

Can you please post your Sonar analysis logs with debug level? Just append -X if it’s a Maven project or -d if it’s a Gradle project (to keep the Gradle logs small, just copy and paste the lines that say org.sonarqube.gradle.SonarQubeTask). Please attach these logs on your next response.

Joe