Skip to content

Scraps jacoco test reports and prints the code coverage to the console

Notifications You must be signed in to change notification settings

jansauer/gradle-print-coverage-plugin

Repository files navigation

Gradle Print Codecoverage Plugin

Scraps jacoco test reports and prints the code coverage to the console. Tools like GitLab can then parse for it for better integration.

For more information see Gitalb test coverage parsing

Getting Started

Add this snippet to yout build script.

plugins {
  id 'jacoco'
  id 'de.jansauer.printcoverage' version '2.0.0'
} 

Extend your ci job configuration.

build-gradle:
  stage: build
  script:
    - ./gradlew build printCoverage
  coverage: '/^Coverage:\s(\d+\.\d+%)/'

Tasks

  • printCoverage The one that prints the coverage ;-)

Configuration

printcoverage {
  coverageType = 'INSTRUCTION'
}
  • coverageType: Type of coverage metric to be printed.
    One of 'INSTRUCTION', 'BRANCH', 'LINE', 'COMPLEXITY', 'METHOD' or 'CLASS'
    Default: 'INSTRUCTION'

Publishing Workflow

Every commit on this repository gets tested via circleci. Commits that are tagged with a semantic version are also automatically published to the gradle plugin directory as a new version.

Contributing

Pull requests are always welcome. I'm grateful for any help or inspiration.

License and Authors

Author: Jan Sauer <[email protected]> (https://jansauer.de)

Copyright 2018, Jan Sauer <[email protected]> (https://jansauer.de)

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Scraps jacoco test reports and prints the code coverage to the console

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published