Get a failure during the :app:createDebugAndroidTestCoverageReport gradle task
* What went wrong:
Execution failed for task ':app:createDebugAndroidTestCoverageReport'.
> A failure occurred while executing com.android.build.gradle.internal.coverage.JacocoReportTask$JacocoReportWorkerAction
> Unable to generate Jacoco report
Inspecting the folder under app/build/outputs/code_coverage/debugAndroidTest/connected/Pixel_4_XL_API_31(AVD) - 12, I see a Sample\ Feature#Sample\ Scenario.ec file, but it's zero bytes. When I look for this same file on the emulator, I see the same file under /sdcard/googletest/internal_use/data/data/com.example.android.testing.androidtestorchestratorsample/coverage_data/Sample Feature#Sample Scenario.ec with a 123 byte file.
Running the :app:connectedDebugAndroidTest task, I don't get a failure, and at this point the .ec file is also in the above described emulator device folder, however, I see this error in the gradle build log:
> Task :app:connectedDebugAndroidTest
Starting 1 tests on Pixel_4_XL_API_31(AVD) - 12
Mar 14, 2022 1:18:07 PM com.android.tools.utp.plugins.host.coverage.AndroidTestCoveragePlugin deviceShellAndCheckSuccess
WARNING: Shell command failed (1): cat "/sdcard/googletest/internal_use///data/data/com.example.android.testing.androidtestorchestratorsample/coverage_data//Sample\ Feature#Sample\ Scenario.ec" > "/data/local/tmp/b57c2a44-ba36-473d-9edf-5441bd14c514-coverage_data/Sample\ Feature#Sample\ Scenario.ec"
cat: /sdcard/googletest/internal_use///data/data/com.example.android.testing.androidtestorchestratorsample/coverage_data//Sample\ Feature#Sample\ Scenario.ec: No such file or directory
👓 What did you see?
When enabling code coverage, it fails to generate a code coverage report and fails the build
✅ What did you expect to see?
A successful build and code coverage report
📦 Which version are you using?
4.9.0
🔬 How could we reproduce it?
A sample project has been created to demonstrate the issue: https://github.com/fwpascual/cucumber-coverage-sample
Steps to reproduce the behavior:
./gradlew clean cAT
The above project is based off of a sample from the Android test samples: https://github.com/android/testing-samples/tree/main/runner/AndroidTestOrchestratorWithTestCoverageSample
🤔 Anything else?
I suspect the issue is in the android test framework, but logging here in case there's any ideas. The android-test repo issue can be found here: https://github.com/android/android-test/issues/1319
The following are some additional details:
Get a failure during the
:app:createDebugAndroidTestCoverageReport
gradle taskInspecting the folder under
app/build/outputs/code_coverage/debugAndroidTest/connected/Pixel_4_XL_API_31(AVD) - 12
, I see aSample\ Feature#Sample\ Scenario.ec
file, but it's zero bytes. When I look for this same file on the emulator, I see the same file under/sdcard/googletest/internal_use/data/data/com.example.android.testing.androidtestorchestratorsample/coverage_data/Sample Feature#Sample Scenario.ec
with a 123 byte file.Running the
:app:connectedDebugAndroidTest
task, I don't get a failure, and at this point the.ec
file is also in the above described emulator device folder, however, I see this error in the gradle build log: