SonarQube developer version 8.4/8.2 code coverage issue - doesn't report unit test counts with Maven based projects

Hi,
I’m using SonarQube Developer Edition 8.4.1
and running the analysis using the mvn sonar:sonar command and integrated code coverage with Jacoco plugin. SonarQube reports % code coverage for unit tests but doesn’t show Unit tests counts.
This was working when we specifying the Jacoco.exe and path for the maven plugin and its broken after SonarQube upgraded to 8.2 and later with Jacoco integration using XML

Thanks,

Hi,

Does your JaCoCo XML report contain test count data?

 
Ann

I don’t see counts. Is it required on this xml file?, if so let me know how to generate.

Thanks,
Raj

Hi Raj,

I’m no JaCoCo expert so I can’t tell you how to (or even whether you can) add those numbers to the file. I can only tell you that if they’re not there, SonarQube can’t/won’t calculate them on its own. I suspect this is a separate report. In fact, from the docs it looks like you need a Surefire report.

 
HTH,
Ann

Hi,

Are you running only mvn sonar:sonar ? If so the life cycle is not running and so no unit tests will be executed…

You have to go via mvn clean verify sonar:sonar that will run the whole life cycle and also run unit tests… that should solve the problem.

1 Like