Android: Easy (and free) test coverage reports with Codecov

Monday, Jan 18, 2016| Tags: android, ci

If you are somehow a good developer, you’ll be at least interested in having Unit Tests on your projects. If you do, you should care about code coverage of those tests. I’m not going to debate if one should aim to 90% coverage or more, but that’s a cool statistic to display on your project page and to keep track on.

Looks good, but could be better!

Looks good, but could be better!

Even more advanced users can use this value to evaluate the quality of Pull-Requests. Can you image rejecting your coworker’s work because he didn’t write any Unit Test?

Codecov offers that and more. In this article you’ll learn how to quickly integrate it in your Android projects.

The first step is adding JaCoCo test reports to your Android project.

I use the jacoco-android-gradle-plugin from arturdm.

Add the following on top of your app/build.gradle

Finally check that everything works by running the jacocoTestReport job.

./gradlew jacocoTestReport

The second step is to modify the .travis.yml file to add the required code to upload the report to Codecov.

Add the jacocoTestReport task to the script part.

  - ./gradlew build jacocoTestReport

Also add the upload task in a after_success entry.

  — bash <(curl -s [](

You are ready to push now! But first, don’t forget to register yourself in Codecov and add your working repository.

Want to learn more Android and Flutter? Check my courses here.


Contact with me