Git Product home page Git Product logo

gradle-scoverage's Introduction

Build Status

gradle-scoverage

A plugin to enable the use of Scoverage in a gradle Scala project.

Getting started

http://plugins.gradle.org/plugin/org.scoverage

This creates an additional task testScoverage which will run tests against instrumented code.

A further task reportScoverage produces XML and HTML reports for analysing test code coverage.

You need to configure the version of Scoverage that will be used. This plugin should be compatible with all 1+ versions.

dependencies {
    scoverage 'org.scoverage:scalac-scoverage-plugin_2.11:1.1.0', 'org.scoverage:scalac-scoverage-runtime_2.11:1.1.0'
}

Then launch command : gradle reportScoverage or gradle checkScoverage

Available tasks

  • testScoverage - Executes all tests and creates Scoverage XML report with information about code coverage
  • reportScoverage - Generates reports (see below).
  • aggregateScoverage - Aggregates reports from multiple sub-projects (see below).
  • checkScoverage - See below.
  • compileScoverageScala - Instruments code without running tests.

ReportScoverage

You can configure output generated by gradle reportScoverage using flags:

Flag name Default value Description
coverageOutputCobertura true Enables/disables cobertura.xml file generation.
coverageOutputXML true Enables/disables scoverage XML output.
coverageOutputHTML true Enables/disables scoverage HTML output.
coverageDebug false Enables/disables scoverage debug output.

Aggregating Reports

There is now experimental support for aggregating coverage statistics across sub-projects.

The project hosting the aggregation task must be configured as the sub-projects are; i.e. with the scoverage plugin applied and the scoverage dependencies configured.

You also have to declare this task:

task aggregateScoverage(type: org.scoverage.ScoverageAggregate)

This will produce a report into build/scoverage-aggregate directory.

Aggregation uses same flags as reporting for enabling/disabling different output types.

For checking coverage of the aggregated result, configure the checkScoverage task:

checkScoverage {
     reportDir = file("$buildDir/scoverage-aggregate")
}

CheckScoverage

By default, when you launch gradle checkScoverage build fail if only 75% of statements in project is covered by tests.

To configure it as you want, add this configuration :

checkScoverage {
    minimumRate = 0.5
}

You can also modify type of value to check from Statements to Lines or Branches:

checkScoverage {
    coverageType = 'Line'
    minimumRate = 0.5
}
checkScoverage {
    coverageType = 'Branch'
    minimumRate = 0.5
}

gradle-scoverage's People

Contributors

0xroch avatar kwestor avatar maiflai avatar nullstress avatar radoburansky avatar sksamuel avatar ubourdon avatar

Watchers

 avatar  avatar

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.