Last active
October 10, 2017 07:15
-
-
Save Hylke1982/109b32bd6862649fbff7f4aa7d277297 to your computer and use it in GitHub Desktop.
Fail a build if the code coverage threshold becomes to low
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- JaCoCo --> | |
<!-- Within maven pom.xml build -> plugins -> plugin --> | |
<build> | |
<plugins> | |
<!-- JaCoCo --> | |
<plugin> | |
<groupId>org.jacoco</groupId> | |
<artifactId>jacoco-maven-plugin</artifactId> | |
<executions> | |
<execution> | |
<id>jacoco-initialize</id> | |
<goals> | |
<goal>prepare-agent</goal> | |
</goals> | |
</execution> | |
<execution> | |
<id>jacoco-report</id> | |
<phase>test</phase> | |
<goals> | |
<goal>report</goal> | |
</goals> | |
</execution> | |
<!-- Generate report site --> | |
<execution> | |
<id>jacoco-site</id> | |
<phase>test</phase> | |
<goals> | |
<goal>report</goal> | |
</goals> | |
</execution> | |
<!-- Fail if coverage is to low --> | |
<execution> | |
<id>jacoco-check</id> | |
<phase>test</phase> | |
<goals> | |
<goal>check</goal> | |
</goals> | |
<configuration> | |
<rules> | |
<rule implementation="org.jacoco.maven.RuleConfiguration"> | |
<element>BUNDLE</element> | |
<limits> | |
<limit implementation="org.jacoco.report.check.Limit"> | |
<counter>INSTRUCTION</counter> | |
<value>COVEREDRATIO</value> | |
<minimum>0.25</minimum> | |
</limit> | |
</limits> | |
</rule> | |
</rules> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment