Total application code coverage?

We are running Sonarqube 5.6.3 and are consolidation application coverage via project analysis.

I see that there is a per module code coverage result and then a consolidated result for the project / App. I would like to understand how the total coverage result is calculated is it something like total lines of code covered or an average of all modules? What I need to validate is that low code amount modules with high or low coverage would skew the results.

I need to produce roll-up metrics for the CIO so this clarification is important.



Hello David,

At Application level, SonarQube is not computing an average of the Coverage % otherwise it would be easy to increase virtually the coverage of an Application by adding to it tiny fake projects having a high level of coverage.
SonarQube looks at the total number of “Lines to Cover” on the Application and compute the “Coverage %” based on that.

Let’s take an example to be concrete. I have an Application made of 3 Projects like this:

Project #    Coverage %    Lines to Cover    Covered Lines
Project 1     92.60%               14829             13732
Project 2     95.70%                6636	          6351
Project 3     97.10%                6654              6461

The Application made of Projects 1,2,3 will have a Coverage % of 94.40% and not 95.13% because we do that:

(13732+6351+6461) / (14829+6636+6654) = 26543 / 28119 = 0.94