JaCoCo for Android

Maven parent project for OSS publishment

License

License

Categories

Categories

JaCoCo Application Testing & Monitoring Code Coverage
GroupId

GroupId

com.sdklite
ArtifactId

ArtifactId

jacoco
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

pom
Description

Description

JaCoCo for Android
Maven parent project for OSS publishment
Project Organization

Project Organization

SDKLite
Source Code Management

Source Code Management

https://github.com/sdklite/jacoco

Download jacoco

Filename Size
jacoco-0.1.0.pom 1009 bytes
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/com.sdklite/jacoco/ -->
<dependency>
    <groupId>com.sdklite</groupId>
    <artifactId>jacoco</artifactId>
    <version>0.1.0</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.sdklite/jacoco/
implementation 'com.sdklite:jacoco:0.1.0'
// https://jarcasting.com/artifacts/com.sdklite/jacoco/
implementation ("com.sdklite:jacoco:0.1.0")
'com.sdklite:jacoco:pom:0.1.0'
<dependency org="com.sdklite" name="jacoco" rev="0.1.0">
  <artifact name="jacoco" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.sdklite', module='jacoco', version='0.1.0')
)
libraryDependencies += "com.sdklite" % "jacoco" % "0.1.0"
[com.sdklite/jacoco "0.1.0"]

Dependencies

test (4)

Group / Artifact Type Version
junit : junit jar 4.12
org.robolectric : robolectric jar 3.0
org.robolectric : android-all jar 5.0.0_r2-robolectric-1
org.hamcrest : hamcrest-library jar 1.3

Project Modules

  • gradle

Introduction

JaCoCo gradle plugin is used to generate code coverage reports for Android project, it creates JaCoCoReport task for the variants which buildType.testCoverageEnabled is true.

Getting Started

  1. Config JaCoCo gradle plugin in build.gradle of root project.

    buildscript {
        repositories {
            ...
            jcenter()
        }
        dependencies {
            ...
            classpath 'com.sdklite.jacoco:gradle:0.1.0'
        }
    }
  2. Apply JaCoCo gradle plugin in build.gradle of android project

    apply plugin: 'com.sdklite.jacoco'
    
    android {
        ...
        buildTypes {
            debug {
                ...
                testCoverageEnabled true
            }
            ...
        }
    }
    
    jacocoUnitTestReport {
        csv.enabled false
        xml.enabled false
        html.enabled true
    }

    The plugin excludes Android generated classes from report by default. You can specify custom exclusion patterns by jacocoUnitTestReport:

    jacocoUnitTestReport {
        ...
        excludes += [
            '**/AutoValue_*.*',
            ...
        ]
    }
  3. Generate coverage report

    $ ./gradlew jacocoTestReport

Example

com.sdklite

SDKLite

SDKLite

Versions

Version
0.1.0