GithubHelp home page GithubHelp logo

igorwojda / gradle-android-junit-jacoco-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vanniktech/gradle-android-junit-jacoco-plugin

0.0 1.0 0.0 452 KB

Gradle plugin that generates JaCoCo reports from an Android Gradle Project

Home Page: http://vanniktech.com

License: Apache License 2.0

Shell 1.82% Groovy 98.18%

gradle-android-junit-jacoco-plugin's Introduction

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.15.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.16.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.2' // type String
  ignoreProjects = [] // type String array
  excludes // type String List
  includeNoLocationClasses = false // type boolean
  includeInstrumentationCoverageInMergedReport = false // type boolean
}

License

Copyright (C) 2015 Vanniktech - Niklas Baudy

Licensed under the Apache License, Version 2.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.