How is the SonarQube coverage report calculated/shown for multi-module maven projects? Is the percentage of code coverage an average of all modules or is it showing only the first report declared in “jacocoXmlReportPaths” setting? I’m asking because in a multi-module maven project, what I get locally from Jacoco coverage reports is different from what is showing in SonarQube coverage.
Coverage ( coverage )
It is a mix of Line coverage and Condition coverage. Its goal is to provide an even more accurate answer to the following question: How much of the source code has been covered by the unit tests?
Coverage = (CT + CF + LC)/(2*B + EL)
where…
I’ll let you read the rest in the docs if you’re intersted.
Thanks for the reply! I understand that it calculates with numbers of lines covered and conditions, etc, but I was wondering how is this done for multiple modules? There are multiple reports generated by jacoco per module and I was wondering if Sonar takes all of them and displays an average percentage? Or how are these reports shown in the SonarQube dashboard? Because, as I mentioned, what I get (per report) locally is 100%, but in Sonar it shows around 64%.
Module values aren’t averaged. Let’s say module boundaries are ignored and the values that are plugged into the formula come from across the entire code base.