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!
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.
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.
script: - ./gradlew build jacocoTestReport
Also add the upload task in a after_success entry.
after_success: — bash <(curl -s [https://codecov.io/bash)](https://codecov.io/bash%29)
You are ready to push now! But first, don’t forget to register yourself in Codecov and add your working repository.