1
votes

I have a multi-module project that I can't seem to get an accurate unit test code coverage report on SonarQube. I use buildr and JaCoCo for the test coverage generation. The file heirarchy is similar to below.

Project --Module1 ----Reports ------Jacoco --------jacoco.cov (jacoco execution file, previously used as .exec) --Module2 --Reports ----Jacoco (Generated HTML, CSV, and XML report files) ----JUnit (JUnit xml report)

At this time, no unit tests exist for Module2. The problem I believe is that the overall coverage on SonarQube reflects only for Module1 and ignores Module2 completely. This makes the coverage appear higher than what it truly is for the whole project. Does anyone have any thoughts on this? Thank you for your input.

1
I'm sorry, the folder structure did not lay out correctly on here. The main point is that one module has the jacoco.cov file and the other module does not. This seems to tell SonarQube that it has a better code coverage for the whole project than what it does.JagWireZ

1 Answers

0
votes

If I get your problem correctly you are looking to force coverage to 0% when there are no coverage file generated. You have to set the correct parameter for this behaviour :

sonar.jacoco.reportMissing.force.zero=true

see documentation for more details : http://docs.sonarqube.org/display/PLUG/Usage+of+JaCoCo+with+Java+Plugin