What is the difference between 'coverage' and 'overall coverage' in the conditions under Quality Gates for a Java project?

994 views
Skip to first unread message

julian...@gmail.com

unread,
Jan 13, 2017, 6:26:25 AM1/13/17
to SonarQube
Hi Everyone, 

I've been using using sonar at work on a large project with a large number of developers for over two years. I'm on sonar server 5.5. I'm really thankful for the help this community has provided in the past. 

When I go into Quality Gates -> [project name] -> Conditions

I have a number of conditions to choose from including:
* Coverage
* Overall Coverage

When I look at Overall Coverage in my dashboard - it shows ~61%. 

I understand that overall coverage is unit test coverage plus integration test coverage. I don't understand how that relates to 'plain coverage'. To me they're the same thing. 

My question is: What is the difference between 'coverage' and 'overall coverage' in the conditions under Quality Gates for a Java project?

Cheers
Julian

Julien HENRY

unread,
Jan 13, 2017, 7:17:38 AM1/13/17
to SonarQube, julian...@gmail.com
Hi Julian,

Overall coverage is the "sum" of unit test coverage + integration test coverage, while "coverage" is just unit test coverage. For example, the SonarJava plugin has 2 different properties to configure path of coverage reports: sonar.jacoco.reportPath and sonar.jacoco.itReportPath

Note that this distinction was removed in SonarQube 6.2: there is now only one set of "coverage measures", that is the "sum" of all coverage reports provided to the scanner (could be unit, IT, ... whatever you name your tests).

++

Julien

julian...@gmail.com

unread,
Jan 14, 2017, 4:05:25 AM1/14/17
to SonarQube, julian...@gmail.com
Hi Julien, 

Great name BTW! 

Thanks for being so helpful. Perhaps I haven't given you enough information. I'm running SonarQube 5.5. My plugins list is below. 

When I look at the available measures - I see the two I showed you before:
* Coverage
* Coverage on New Code

I have the following conditions to add:
* Coverage -> IT Coverage
* Coverage -> Overall Coverage. 
* Coverage -> Unit Tests

Now I have 50+ Integration tests, and 500+ unit tests. 

When I look at my coverage dashboard - the coverage percentage for 'Coverage' is 60% and the 'Overall Coverage' is also 60%. 

Now - I think you've misunderstood the situation. From what I can see "Coverage" can't be "Unit Test Coverage" because
(a) There is a separate option for "Unit Test Coverage" which is not "Coverage"
(b) The overall coverage percentages for a project with both UT's and IT's have a matching value for "Coverage" and "Overall Coverage"

My original question was: What is the difference between 'coverage' and 'overall coverage' in the conditions under Quality Gates for a Java project?
(which I believe is still unanswered)

My follow-up question is: Could 'overall coverage' apply to the percentage for the overall project, whilst 'coverage' applies to individual classes if the flag for individual classes is switched on, otherwise it defaults to overall coverage?

Cheers
Julian

Plugins List
---
checkstyle - Name    Checkstyle - Version 2.4
csharp - Name    C# - Version 5.0
findbugs - Name    Findbugs - Version 3.3
java - Name    Java - Version 3.9
javascript - Name    JavaScript - Version 2.13
ldap - Name    LDAP - Version 1.5.1
motionchart - Name    Motion Chart - Version 1.7
pitest - Name    Pitest - Version 0.6
scmgit - Name    Git - Version 1.2
scmsvn - Name    SVN - Version 1.3
status - Name    SVG Badges - Version 2.0.1
tabmetrics - Name    Tab Metrics - Version 1.4.1
timeline - Name    Timeline - Version 1.5
web - Name    Web - Version 2.4
widgetlab - Name    Widget Lab - Version 1.8.1
xml - Name    XML - Version 1.4.1
---

julian...@gmail.com

unread,
Jan 16, 2017, 3:43:53 AM1/16/17
to SonarQube
Hi Julien,

My mistake. You were correct.

I need to ask a different question which I'll do on another thread.

Cheers
Julian

Reply all
Reply to author
Forward
0 new messages