Adds jacoco for code coverage (#5084)

* Adds jacoco for code coverage

This sets up jacoco instrumentation for code coverage. Preparing for
master and PR coverage reporting via sonarcloud.

* Set initial required coverage to 0
This commit is contained in:
Jim Schubert 2020-01-23 23:46:07 -05:00 committed by GitHub
parent 327ffc10bb
commit 09fd494836
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

59
pom.xml
View File

@ -150,6 +150,52 @@
</dependency> </dependency>
</dependencies> </dependencies>
</plugin>--> </plugin>-->
<!-- https://www.jacoco.org/jacoco/trunk/doc/maven.html -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>PACKAGE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
<configuration>
<excludes>
<exclude>**/gradle-wrapper.jar</exclude>
</excludes>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
@ -159,8 +205,18 @@
<useSystemClassLoader>false</useSystemClassLoader> <useSystemClassLoader>false</useSystemClassLoader>
<junitArtifactName>none:none</junitArtifactName> <junitArtifactName>none:none</junitArtifactName>
<testNGArtifactName>org.testng:testng</testNGArtifactName> <testNGArtifactName>org.testng:testng</testNGArtifactName>
<argLine>-XX:+StartAttachListener</argLine> <argLine>@{argLine} -XX:+StartAttachListener</argLine>
</configuration> </configuration>
<dependencies>
<dependency>
<!-- must be on the classpath for test instrumentation -->
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.agent</artifactId>
<classifier>runtime</classifier>
<version>${jacoco.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-dependency-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
@ -1407,5 +1463,6 @@
<surefire-version>3.0.0-M3</surefire-version> <surefire-version>3.0.0-M3</surefire-version>
<reflections-version>0.9.10</reflections-version> <reflections-version>0.9.10</reflections-version>
<mockito-version>3.2.0</mockito-version> <mockito-version>3.2.0</mockito-version>
<jacoco.version>0.8.5</jacoco.version>
</properties> </properties>
</project> </project>