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 ...

Get Learning Android Application Testing now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.