Android code coverage example with https://codecov.io
Java
Latest commit 25e2d62 Aug 26, 2016 @stevepeak stevepeak committed on GitHub Update README.md

README.md

Build Status codecov.io

Codecov Android Example

This repository serves as an example on how to integrate Codecov in Android projects.

Unit tests coverage reports

Codecov parses uploaded test coverage reports but your project is required to generate them first. You can use jacoco-android-gradle-plugin to create appropriate gradle tasks and run this command to generate the reports:

./gradlew jacocoTestReport

Instrumentation tests coverage reports

Generating instrumentation tests code coverage reports requires a minor change to the build script.

android {
  buildTypes {
    debug {
      testCoverageEnabled true
    }
  }
}

Running the command below generates the reports:

./gradlew connectedCheck

Configure Travis CI

If you use Travis CI as your continuous integration server you can configure it to build the project, generate test coverage reports and upload them to Codecov. See an example .travis.yml file on how to do this.