• Stars
    star
    397
  • Rank 104,606 (Top 3 %)
  • Language
    Groovy
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Gradle plugin that generates JaCoCo reports from an Android Gradle Project

gradle-android-junit-jacoco-plugin

Gradle plugin that generates Jacoco reports from a Gradle Project. Android Application, Android Library, Kotlin and Java Plugins are supported by this plugin. When this plugin is applied it goes over every subproject and creates the corresponding Jacoco tasks.

Android project

JVM Unit-Tests

  • Task jacocoTestReport<Flavor><BuildType>
    • Executes the test<Flavor><BuildType>UnitTest task before
    • Gets executed when the check task is executed
    • Generated Jacoco reports can be found under build/reports/jacoco/<Flavor>/<BuildType>.

Instrumented tests

  • Task combinedTestReport<Flavor><BuildType>
    • Executes the test<Flavor><BuildType>UnitTest and create<Flavor><BuildType>CoverageReports tasks before (JVM and instrumented tests)
    • Gets executed when the check task is executed
    • Generated Jacoco reports can be found under build/reports/jacocoCombined/<Flavor>/<BuildType>. Note that this task is only generated, if you set testCoverageEnabled = true for your build type, e.g.
android {
  buildTypes {
    debug {
      testCoverageEnabled true
    }
  }
}

Where <BuildType> is usually debug & release unless additional build types where specified. <Flavor> is optional and will be ignored if not specified.

For instance when having debug & release build types and no flavors the following tasks would be created: jacocoTestReportDebug and jacocoTestReportRelease.

When having debug & release build types and red & blue flavors the following tasks would be created: jacocoTestReportRedDebug, jacocoTestReportBlueDebug, jacocoTestReportRedRelease and jacocoTestReportBlueRelease.

Java project

  • Task jacocoTestReport
    • Executes the test task before
    • Gets executed when the check task is executed
    • Generated Jacoco reports can be found under build/reports/jacoco/.

In addition the plugin generates mergeJacocoReports & jacocoTestReportMerged tasks.

mergeJacocoReports will merge all of the jacoco reports together.

jacocoTestReportMerged will output an xml and html file for the merged report.

Works with the latest Gradle Android Tools version 3.4.0. This plugin is compiled using Java 7 hence you also need Java 7 in order to use it.

Set up

root/build.gradle

buildscript {
  repositories {
    mavenCentral()
  }
  dependencies {
    classpath "com.vanniktech:gradle-android-junit-jacoco-plugin:0.16.0"
  }
}

apply plugin: "com.vanniktech.android.junit.jacoco"

Information: This plugin is also available on Gradle plugins

Snapshot

buildscript {
  repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
  }
  dependencies {
    classpath "com.vanniktech:gradle-android-junit-jacoco-plugin:0.17.0-SNAPSHOT"
  }
}

apply plugin: "com.vanniktech.android.junit.jacoco"

Configuration

Those are all available configurations - shown with default values and their types. More information can be found in the Java Documentation of the Extension.

junitJacoco {
  jacocoVersion = '0.8.7' // type String
  ignoreProjects = [] // type String array
  excludes // type String List
  includeNoLocationClasses = false // type boolean
  includeInstrumentationCoverageInMergedReport = false // type boolean
  xml.enabled = true
  csv.enabled = true
  html.enabled = true
}

License

Copyright (C) 2015 Vanniktech - Niklas Baudy

Licensed under the Apache License, Version 2.0

More Repositories

1

Emoji

A library to add Emoji support to your Android / JVM Application
Kotlin
1,495
star
2

gradle-dependency-graph-generator-plugin

Gradle plugin that generates dependency graphs from your project.
Kotlin
1,343
star
3

gradle-maven-publish-plugin

A Gradle plugin that publishes your Android and Kotlin libraries, including sources and javadoc, to Maven Central or any other Nexus instance.
Kotlin
1,103
star
4

OnActivityResult

OnActivityResult annotation compiler for Android
Java
461
star
5

RxRiddles

Riddling your way to masterย RxJava
Kotlin
455
star
6

lint-rules

A set of very opinionated lint rules.
Kotlin
353
star
7

gradle-code-quality-tools-plugin

Gradle plugin that generates ErrorProne, Findbugs, Checkstyle, PMD, CPD, Lint, Detekt & Ktlint Tasks for every subproject.
Kotlin
343
star
8

RxPermission

Reactive permissions for Android
Java
189
star
9

VNTNumberPickerPreference

NumberPicker Preference for Android
Java
174
star
10

gradle-android-apk-size-plugin

Gradle plugin that generates CSV files with apk size per output and variant of an apk
Groovy
84
star
11

gradle-android-javadoc-plugin

Gradle plugin that generates Java Documentation from an Android Gradle project.
Shell
80
star
12

VNTFontListPreference

ListPreference for Android which displays fonts
Java
77
star
13

kotlin-on-code-quality-tools

Demonstration of Code Quality Tools that are applicable with Kotlin
Kotlin
45
star
14

espresso-utils

Provides helper methods for asserting a few things that Espresso does not support out of the box.
Java
27
star
15

blurhash

BlurHash support for iOS, Android and JVM via Kotlin Multiplatform
Kotlin
19
star
16

TextBuilder

Provides a Class with a builder pattern for building beautiful text super easily. Internally it uses the Spannable API.
Java
17
star
17

SpeedReader

Cross-platform SpeedReader developed with Qt
C++
16
star
18

junit-rules

A set of handy junit rules.
Kotlin
15
star
19

RxBilling

Reactive wrapper around the Android Billing API
Kotlin
13
star
20

config-home

My home directory
Shell
12
star
21

multiplatform-locale

Type Safe Kotlin Multiplatform Locale implementation
Kotlin
10
star
22

SparseBuilders

Builders for SparseIntArray, SparseBooleanArray and SparseArray
Java
7
star
23

ui

Kotlin Multiplatform UI goodies
Kotlin
3
star
24

config-sublime

My Sublime 3 configuration
Python
1
star
25

playground

Empty project with basic dependencies for testing a few things out.
Ruby
1
star