androidTest
directory.testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
)added dependencies:
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
added JaCoCo as dependency, as well.
createDebugAndroidTestCoverageReport
Gradle task, all the test cases run successfully but coverage is 0% in reportI am guessing that is due to this error:
V/InstrumentationResultParser: Error: Failed to generate Emma/JaCoCo coverage. V/InstrumentationResultParser: INSTRUMENTATION_CODE: -1
Google just redirected me to my own answer ...
As it turned out, for Android projects one (meanwhile) has to use a path alike this:
"${project.buildDir}/intermediates/javac/debug/classes"
In case you may wonder... JaCoCo only works for @RunWith(JUnit4.class)
Java unit tests in test
(but not @RunWith(AndroidJUnit4.class)
Android integration tests in androidTest
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With