Enforce minimum Jacoco line coverage 70/96570/1
authorLee, Tian (tl5884) <tianl@amdocs.com>
Thu, 3 Oct 2019 13:53:50 +0000 (14:53 +0100)
committerLee, Tian (tl5884) <tianl@amdocs.com>
Thu, 3 Oct 2019 13:53:50 +0000 (14:53 +0100)
Current coverage at 87%, enforced limit set to 80%

Change-Id: I0f167433e21ad444ac01987a167c1964f8c88ab8
Issue-ID: AAI-2364
Signed-off-by: Lee, Tian (tl5884) <tianl@amdocs.com>
pom.xml

diff --git a/pom.xml b/pom.xml
index 8dc1cd1..2ecb68d 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -68,6 +68,9 @@
                <aai.base.image.version>1.6.0</aai.base.image.version>
                <!-- This will be used for the docker images as the default format of maven build has issues -->
                <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
+               <!-- Code coverage enforcement -->
+               <jacoco.report.directory>${project.build.directory}/code-coverage</jacoco.report.directory>
+               <jacoco.line.coverage.limit>0.80</jacoco.line.coverage.limit>
        </properties>
 
        <distributionManagement>
                                        </execution>
                                </executions>
                        </plugin>
+                       <plugin>
+                               <groupId>org.jacoco</groupId>
+                               <artifactId>jacoco-maven-plugin</artifactId>
+                               <executions>
+                                       <execution>
+                                               <id>default-check</id>
+                                               <goals>
+                                                       <goal>check</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <dataFile>${jacoco.report.directory}/jacoco-ut.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>
        </build>
 </project>