I'm trying to analyze java code with the SonarQube Scanner (version 3.1.0.1141).
- SonarQube version : 5.6.6
- Sonar Java plugin version : 4.12.0.11033
- jacoco version : 0.8.0
I have filled the sonar-project.properties with those properties :
# Sonar sources and metadata
sonar.language=java
sonar.sources=src/main
sonar.java.source=1.8
sonar.sourceEncoding=UTF-8
sonar.java.binaries=target/classes
sonar.java.libraries=target/lib
sonar.tests=src/test
sonar.java.coveragePlugin=jacoco
sonar.junit.reportsPath=target/surefire-reports
sonar.surefire.reportsPath=target/surefire-reports
While jacoco report gives me this result for one class :
- Coverage : 84%
- Branch Coverage : 71%
- Missed : 9
- Complexity : 24
- Missed : 6
- Lines : 69
- Missed : 0
- Methods : 8
- Missed : 0
- Classes : 1
SonarQube displays the measures :
- Condition coverage 62,5%
- Coverage 81,7%
- Line coverage 92,8%
- Lines to cover 69
- Overall condition coverage 62,5%
- Overall coverage 81,7%
- Overall line coverage 92,8%
- Overall uncovered branches 15
- Overall uncovered lines 5
- Uncovered branches 15
- Uncovered lines 5
According to the sonar metric definition page, the sonar key for condition coverage is branch_coverage, so I thought condition and branch coverage are the same things.
How to explain the different results?