0
votes

i have the problem that in SonarQube v6.7 the line coverage is lower than in jacoco report.

When I'm opening sonar my class file has a lot of uncovered lines. When opening the jacoco report, it shows me that these lines are covered.

I'm using the gradle plugin. (v2.6)

Any ideas what can be the issue?

1
Could you be more specific ? Project structure ? Are uncovered lines have a common feature ? - ToYonos
sonar configuration, maybe you exclude files from coverate - Simon Schrottner

1 Answers

0
votes

OK, had found the solution in a different thread.

Just added into the build.gradle

subprojects {
tasks.withType(Test) {
    // redirect all coverage data to one file
    // ... needs cleaning the data prior to the build to avoid accumulating coverage data of different runs.
    // see `task cleanJacoco`
    jacoco {
//            destinationFile = file("$rootProject.buildDir/jacoco/${project.name}.exec")
        destinationFile = file("$rootProject.buildDir/jacoco/test.exec")
    }
}

task cleanJacoco(dependsOn: 'clean') {  delete "$buildDir/jacoco" }

}