Temperature converter code coverage
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 page at https://github.com/jacoco/jacoco or Maven central. Therefore, it is recommended that you make the version explicit.
Generating code coverage analysis report
You will need to have an emulator...