0

I'm using JaCoCo to measure unit test coverage in my Android project. While analyzing the report, I noticed that the code coverage for my classes is being grouped under the default package instead of their respective package names.

Here’s the coverage report screenshot: []1

As you can see, the coverage for some classes is displayed under the default element. This causes confusion because it doesn't reflect the actual package structure of the project.

tasks.register("jacocoCoverage", JacocoReport) {
description = "Calculate code coverage using JaCoCo"
group = "verification"

dependsOn(tasks.named("testStageDebugUnitTest"))

executionData(fileTree(dir: "$buildDir", includes: ["**/*.exec"]))

sourceDirectories.setFrom(files(
        "$projectDir/src/main/java"
))

classDirectories.setFrom(fileTree(dir: "$buildDir/tmp/kotlin-classes", includes: [
        "stageDebugUnitTest/**/*.class"
]))

reports {
    xml.required.set(true)
    html.required.set(true)
    csv.required.set(false)
    html.outputLocation.set(file("$buildDir/jacoco/html"))
    xml.outputLocation.set(file("$buildDir/jacoco/jacoco.xml"))
}}

Why is JaCoCo grouping code coverage under default instead of their actual packages? How can I fix this issue so that the coverage report properly reflects the package structure?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.