yoni
yoni

Reputation: 1364

Overall project code coverage summary

I have root module with sub-modules. I need one code coverage summary for the whole project (include all sub-modules).

Currently, with the attached build.gradle configuration, there is in the main directory a summary file (jacoco/jacocoHtml/index.html) with only the summary of the last sub-module (the last checked sub-module [I assume this is random]) and a separate directory for each package of each sub-module.

currently configuration:

jacocoTestReport {
        reports {
            xml.enabled false
            csv.enabled flase
            html.destination file("c:/jacoco/jacocoHtml")
        }
    }

Upvotes: 1

Views: 1232

Answers (1)

lance-java
lance-java

Reputation: 28071

Each subproject can run its own tests and produce its own separate coverage execution file, but don't have a JacocoReport task for each subproject.

Instead, use a JacocoMerge task to merge the individual execution files into one and then generate a single JacocoReport from the merged execution file. You'll need to configure all class and source directories from the subprojects on the JacocoReport task

There's a sample test here which merges two test tasks within a single project. This could be adapted for multi module

Upvotes: 2

Related Questions