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

dawnwords/jacoco-badge-gradle-plugin: jacoco badge gradle plugin

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

开源软件名称(OpenSource Name):

dawnwords/jacoco-badge-gradle-plugin

开源软件地址(OpenSource Url):

https://github.com/dawnwords/jacoco-badge-gradle-plugin

开源编程语言(OpenSource Language):

Java 100.0%

开源软件介绍(OpenSource Introduction):

Jacoco Badge Gradle Plugin Build Status Coverage Status

Jacoco Badge Gradle Plugin aims to analyze Jacoco Test Coverage Report and update the README file in your Java project with the badge link generated by Shields IO to reflect your code coverage on code change.

Usage

  1. Add this plugin in your build.gradle
plugins {
    id 'java'
    id 'jacoco'
    id 'com.github.dawnwords.jacoco.badge'
}
  1. Put the badge link placeholder in your README.md
# Your Project Name

some basic description

### code coverages
![LINE](http://line.coverage.link)
![BRANCH](http://branch.coverage.link)
![COMPLEXITY](http://complexity.link)

### some other introductions

Note that by default the README.md file should be placed in the project root directory together with your build.gradle file.

  1. Execute generate jacoco badge task after jacoco report task
./gradlew jacocoTestReport generateJacocoBadge

then you'll see the coverage link in your README.md is automatically updated based on your jacoco coverage report shown as following

![LINE](https://img.shields.io/badge/line--coverage-87%25-brightgreen.svg)
![BRANCH](https://img.shields.io/badge/branch--coverage-78%25-yellow.svg)
![COMPLEXITY](https://img.shields.io/badge/complexity-1.90-brightgreen.svg)

Plugin Settings

There's a configuration point for this plugin: jacocoBadgeGenSetting in your build.gradle. You can manually specify jacocoReportPath, readmePath and limit and their default value is shown as following:

jacocoBadgeGenSetting {
    jacocoReportPath  "$buildDir/reports/jacoco/test/jacocoTestReport.xml"
    readmePath "$projectDir/README.md"
    // since v0.2.0, percentage limitation (0-100) for different type of coverage
    limit = ['instruction': 0, 'branch': 0, 'line': 0, 'method': 0, 'class': 0]
}

Coverage Badge Type

Jacoco gives us 6 coverage metrics in its test report, namely INSTRUCTION, BRANCH, LINE, COMPLEXITY, METHOD and CLASS. Your badge link should be place within a new line and the alt part should be one of the 6 values so that this plugin can detect them.




鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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