Skip to content

[Deprecated] Gradle plugin which allows to generate Jacoco coverage report for both integration & unit tests

License

Notifications You must be signed in to change notification settings

paveldudka/JacocoEverywhere

Repository files navigation

JacocoEverywhere

Gradle plugin which allows to generate Jacoco coverage report for both integration & unit tests

Warning!

This plugin is not maintained anymore and is deprecated!

Why?

Android plugin has built-in support for generating test coverage report:

android {
    buildTypes {
        debug {
            testCoverageEnabled = true
        }
    }
}

However, this report only shows test coverage for your integration tests (aka UI tests, aka those ones you run with ./gradlew connectedCheck).

But what we really want - is to see test coverage report for both integration AND unit test suites!

jacoco-everywhere plugin does just that!

Usage

  1. Enable code coverage like you normally would for your integration tests:
android {
    buildTypes {
        debug {
            testCoverageEnabled = true
        }
    }
}
  1. Add jacoco-everywhere dependency to Android module buildscript and apply jacoco-everywhere plugin: build.gradle:
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.trickyandroid:jacoco-everywhere:0.2.1'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'jacoco-everywhere'
  1. execute ./gradlew connectedCheck from your command line

  2. Observe Jacoco test coverage report in <your_project_dir>/<android_module>/build/reports/coverage/debug/index.html

About

[Deprecated] Gradle plugin which allows to generate Jacoco coverage report for both integration & unit tests

Resources

License

Stars

Watchers

Forks

Packages

No packages published