Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to generate code coverage report for androidTest using Jacoco in android studio

I am able to generate code coverage report using Jacoco for test folder and I also want to generate report for instrument testcase in androidTest folder. Please share any code snippet or link to refer.

like image 336
Karanbeer Kaur Avatar asked Dec 02 '15 05:12

Karanbeer Kaur


People also ask

How do I get my JaCoCo code coverage report?

To get code coverage reports in a Maven project, we first need to set up the JaCoCo Maven plugin for that project. By integrating the JaCoCo plugin, the results of the code coverage analysis can be reviewed as an HTML report. The current version of the JaCoCo-Maven plugin can be downloaded from the MVN Repository.

How do I get code coverage on Android?

Android Studio has a built-in feature that allows you to run tests with code coverage. Simply navigate to the src/test/java folder and right click. Then select Run 'Tests in 'java'' with Coverage (awkward use of single quotes theirs not mine).

How do I create a JaCoCo report?

For generating JaCoCo reports only run the maven build with profile jacoco-generate-report as it is shown in the example above. After the command was executed, in directory target/jacoco-report you can find reports in HTML and XML formats.


1 Answers

Here is a link to an article that I wrote about code coverage with Android instrument test case.

like image 97
Uriel Frankel Avatar answered Oct 13 '22 10:10

Uriel Frankel