vanniktech/gradle-android-junit-jacoco-plugin

Merged report is empty

lukas1 opened this issue · 3 comments

Using this plugin, version 0.16.0 I'm calling

./gradlew clean jacocoTestReportDebug mergeJacocoReports jacocoTestReportMerged 

I'd expect the merged report to contain list of combined reports from all modules, instead, the generated HTML file is empty. Modules themselves have correct reports

My configuration

ext {
  jaCoCoVersion = "0.8.5"
}
jacocoVersion = rootProject.ext.jaCoCoVersion
    excludes = [
            '**/R.class',
            '**/R$*.class',
            '**/*$ViewInjector*.*',
            '**/*$ViewBinder*.*',
            '**/BuildConfig.*',
            '**/Manifest*.*'
    ]

android {
    buildTypes {
        debug {
            testCoverageEnabled true
        }
    }
}

My Android build tools version: 3.6.1
Gradle version used: 5.6.4

JUnit version used: 5.3.1

Some info that might help shed some light on this:

In my project with both Android and JVM modules, and both JVM and instrumented tests, I run the following:
./gradlew clean jacocoTestReport combinedTestReportDebug mergeJacocoReports jacocoTestReportMerged

In each Android module, it appears that the instrumented coverage ends up under project/module/build/reports/coverage/debug/, while the JVM coverage ends up under project/module/build/reports/jacocoCombined/debug/.

Then at the top level, the merged report is at project/build/reports/jacoco/, but the coverage data in it seems to only be from each Android module's jacocoCombined report, which as noted before is only the JVM coverage. (JVM modules naturally produce only one report and it does get included in the merged report as expected.)

In the lukas1's example, the combine task isn't run at all so maybe that's why their merged report is completely empty.

So my guess is that the module-level reports ending up in different directories instead of being actually combined is the bug? And then the overall report is behaving properly but just has bad inputs. Alternatively, the module-level split reports can't be helped but then the merged report should be pulling from both sources.

Edit: To clarify, I have the following configuration.

junitJacoco {
    jacocoVersion = '0.8.4'
    includeInstrumentationCoverageInMergedReport = true
}

Gradle 6.3, AGP 4.0.0.

After digging a little bit in this plugin's source code, the fact that anything ends up in a dir called coverage/ seems unexpected.

Is there anything this plugin needs to do?

I'm closing this issue due to inactivity. If you have any further input on the issue, don't hesitate to reopen this issue or post a new one.