简体   繁体   中英

How to generate code coverage report for integration test using sonar + jacoco in mutli module system using gradle

Let's say Main module A And Sub modules are B and C .In my gradle file I have added only below configuration for sonar and jacoco.

apply plugin: 'spring-boot'
apply plugin: 'org.sonarqube'
app vly plugin: 'jacoco'

jacocoTestReport {
    group = "Reporting"
    description = "Generate Jacoco coverage reports after running tests."
    additionalSourceDirs = files(sourceSets.main.allJava.srcDirs)
}

sonarqube {
    properties {
        property "sonar.projectName", "A"
        property "sonar.projectKey", "org.codehaus.sonar:A"
        property "sonar.jacoco.reportPath", "${project.buildDir}/jacoc /test.exec"
        property "sonar.jacoco.itReportPath", "${project.buildDir}/jacoco/jacoco-it.exec"
    }
}

when I run the gradle task : ./gradlew clean :A:sonarqube -Pprod Build Successful but showing below info

INFO - JaCoCoItSensor: JaCoCo IT report not found: /../../../../A/build/jacoco/jacoco-it.exec

Integration tests are working fine. but only show the code coverage of main module. What I want is, when I run the integration test, the sub module code also covered in the code coverage report.

You may want to take a look at sonarqube gradle plugin excluding jacoco integration tests

It seems that this property is not available

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM