• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

vanniktech/gradle-android-junit-jacoco-plugin: Gradle plugin that generates JaCo ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

vanniktech/gradle-android-junit-jacoco-plugin

开源软件地址(OpenSource Url):

https://github.com/vanniktech/gradle-android-junit-jacoco-plugin

开源编程语言(OpenSource Language):

Groovy 98.2%

开源软件介绍(OpenSource 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.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.3' // 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




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap