`clearPackageData` removes the files(.exec & .ec) which are required to generate the JaCoCo report: Android

Viewed 179

I want to clear the app states after the execution of each test case, for that, I have added: testInstrumentationRunnerArguments clearPackageData: 'true'.

But because of clearPackageData, when I run the command to generate a test coverage report it gives me the below error:

Execution failed for task ':app:createDebugAndroidTestCoverageReport'. 
java.io.IOException: No coverage data to process in directories 
[/Users/.../app/build/outputs/code_coverage/debugAndroidTest/connected]

I think clearPackageData removes the .ec and .exec files as well which are required to generate the JaCoCo report. When I remove clearPackageData, it generates a report properly.

Is there any way to generate a Coverage report by keeping clearPackageData in .gradle file? Did I miss something? Any help is appreciated. Thank you!

0 Answers
Related