March 2015
Beginner to intermediate
274 pages
6h 1m
English
The Android Gradle plugin has support for Jacoco code coverage out of the box. The setup involves selecting which build flavor you want to obtain coverage reports for, and selecting your Jacoco version. We want to instrument our debug flavor so that we can have coverage without affecting release code. Under the android closure, add these lines to your android/build.gradle file:
android {
…
buildTypes {
debug {
testCoverageEnabled true
}
}
jacoco {
version = '0.7.2.201409121644'
}
}The Jacoco version does not actually have to be added here, however, the version of Jacoco shipping with Android is currently behind the latest release. The latest version of the Jacoco coverage library can be found on their GitHub ...
Read now
Unlock full access