Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

Commit 29ec07ad authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier
Browse files

Extended "pom.xml" to generate coverage reports in CSV, HTML and XML by using...

Extended "pom.xml" to generate coverage reports in CSV, HTML and XML by using "jacoco-maven-plugin".

Generate reports by executing:

  mvn test

Generated reports are located in:

  <project_root>/target/site/coverage-reports

Now, this Maven config can be used to activate report generation in Gitlab.
parent a13642ed
......@@ -34,6 +34,55 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<!-- Sets the VM argument line used when unit tests are run. -->
<argLine>${surefireArgLine}</argLine>
<!-- Skips unit tests if the value of skip.unit.tests property is true -->
<skipTests>${skip.unit.tests}</skipTests>
<!-- Excludes integration tests when unit tests are run. -->
<excludes>
<exclude></exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<executions>
<!-- Use JaCoCo's Java agents to record coverage data by using on-the-fly class file instrumentation. -->
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<output>file</output>
<destFile>${project.build.directory}/coverage-data/jacoco-unit-tests.coverage</destFile>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<!-- Use JaCoCo agent output to create coverage reports in CSV, HTML and XML format. -->
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/coverage-data/jacoco-unit-tests.coverage</dataFile>
<outputDirectory>${project.reporting.outputDirectory}/coverage-reports</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment