diff options
author | Lee, Tian (tl5884) <tianl@amdocs.com> | 2019-03-27 15:55:28 +0000 |
---|---|---|
committer | Tian Lee <TianL@amdocs.com> | 2019-03-28 12:37:42 +0000 |
commit | 805f654e66cf34be8e314a43b5498020da6e7851 (patch) | |
tree | 393d625d461c2d520909d2c86be7ba88fe528061 /pom.xml | |
parent | 12b124314b1c45dec208083896e00ec799cddaef (diff) |
Configure Jacoco plugin to enforce min coverage
Jacoco plugin is configured to set the minimum line coverage ratios to
equal that of the current coverage level, to prevent future updates from
decreasing the coverage level.
Change-Id: I5913c3bf99fd98e344eaf6ee176e232bd7e61bb1
Issue-ID: AAI-2293
Signed-off-by: Lee, Tian (tl5884) <tianl@amdocs.com>
Diffstat (limited to 'pom.xml')
-rw-r--r-- | pom.xml | 50 |
1 files changed, 47 insertions, 3 deletions
@@ -21,7 +21,8 @@ ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -42,6 +43,10 @@ <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <sitePath>/content/sites/site/org/onap/aai/${project.artifactId}/${project.version}</sitePath> + <!-- Minimum code coverage percentage. Please update this figure as coverage increases to prevent any drops in + coverage caused by new changes. Note that this figure cannot be lower than the ONAP requirement of 0.55 --> + <jacoco.line.coverage.limit>0.90</jacoco.line.coverage.limit> + <jacoco.report.directory>${project.build.directory}/coverage-reports</jacoco.report.directory> </properties> <modules> @@ -131,20 +136,59 @@ <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> + <version>0.7.9</version> <configuration> <dumpOnExit>true</dumpOnExit> </configuration> <executions> <execution> - <id>jacoco-initialize-unit-tests</id> + <id>pre-unit-test</id> <goals> <goal>prepare-agent</goal> </goals> <configuration> - <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile> + <destFile>${jacoco.report.directory}/jacoco.exec</destFile> + <propertyName>surefireArgLine</propertyName> <!-- <append>true</append> --> </configuration> </execution> + <execution> + <id>post-unit-test</id> + <phase>test</phase> + <goals> + <goal>report</goal> + </goals> + <configuration> + <!-- Sets the path to the file which contains the execution data. --> + <dataFile>${jacoco.report.directory}/jacoco.exec</dataFile> + <!-- Sets the output directory for the code coverage report. --> + <outputDirectory>${jacoco.report.directory}/jacoco</outputDirectory> + </configuration> + </execution> + <execution> + <id>default-check</id> + <goals> + <goal>check</goal> + </goals> + <configuration> + <dataFile>${jacoco.report.directory}/jacoco.exec</dataFile> + <rules> + <!-- implementation is needed only for Maven 2 --> + <rule + implementation="org.jacoco.maven.RuleConfiguration"> + <element>BUNDLE</element> + <limits> + <limit + implementation="org.jacoco.report.check.Limit"> + <counter>LINE</counter> + <value>COVEREDRATIO</value> + <minimum>${jacoco.line.coverage.limit}</minimum> + </limit> + </limits> + </rule> + </rules> + </configuration> + </execution> </executions> </plugin> </plugins> |