Adjorno
Adjorno

Reputation: 51

How to configure JaCoCo (to exclude some source files) for Android project with isTestCoverageEnabled=true

The code coverage works perfectly fine for me when just set isTestCoverageEnabled = true in my BuildType Android Gradle configuration. It creates 2 tasks createReleaseUnitTestCoverageReport for release build type and createDebugUnitTestCoverageReport for debug one.

The issue that all source files appear in the report and I would like to exclude some of them - e.g. Dagger generated classes etc.

According to the Android docs the only configuration to change is

testCoverage {
    jacocoVersion = "YOUR JACOCO VERSION"
}

and nothing else.

Since there is no jacocoTestReport task all solutions from StackOverflow don't work.

Is there any decent way to configure JaCoCo for Android except creating a custom jacocoTestReport task?

Upvotes: 1

Views: 270

Answers (0)

Related Questions