Skip to content

Commit a479f13

Browse files
xzel23svanteschubert
authored andcommitted
add jacoco code coverage reporting
1 parent 1761999 commit a479f13

File tree

6 files changed

+83
-2
lines changed

6 files changed

+83
-2
lines changed

generator/schema2template/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
<groupId>org.apache.maven.plugins</groupId>
103103
<artifactId>maven-surefire-plugin</artifactId>
104104
<configuration>
105+
<argLine>${surefireArgLine}</argLine>
105106
<skipTests>${codegen}</skipTests>
106107
<systemPropertyVariables>
107108
<!-- see https://cwiki.apache.org/confluence/display/MAVEN/Maven+Properties+Guide -->
@@ -162,6 +163,10 @@
162163
</execution>
163164
</executions>
164165
</plugin>
166+
<plugin>
167+
<groupId>org.jacoco</groupId>
168+
<artifactId>jacoco-maven-plugin</artifactId>
169+
</plugin>
165170
</plugins>
166171
</build>
167172
<reporting>

odfdom/pom.xml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,13 @@
200200
<groupId>org.apache.maven.plugins</groupId>
201201
<artifactId>maven-surefire-plugin</artifactId>
202202
<configuration>
203+
<argLine>-javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile=${project.build.directory}/coverage-reports/jacoco-ut.exec</argLine>
203204
<systemPropertyVariables>
204205
<org.odftoolkit.odfdom.validation>true</org.odftoolkit.odfdom.validation>
205206
</systemPropertyVariables>
206-
<exclude>**/integrationtest/PerformanceIT.java</exclude>
207+
<excludes>
208+
<exclude>**/integrationtest/PerformanceIT.java</exclude>
209+
</excludes>
207210
</configuration>
208211
</plugin>
209212
<plugin>
@@ -330,6 +333,22 @@
330333
</execution>
331334
</executions>
332335
</plugin>
336+
<plugin>
337+
<groupId>org.jacoco</groupId>
338+
<artifactId>jacoco-maven-plugin</artifactId>
339+
<configuration>
340+
<dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
341+
<outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
342+
</configuration>
343+
<executions>
344+
<execution>
345+
<id>default-report</id>
346+
<goals>
347+
<goal>report</goal>
348+
</goals>
349+
</execution>
350+
</executions>
351+
</plugin>
333352
</plugins>
334353
</build>
335354
<!-- More Project Information -->
@@ -574,6 +593,7 @@
574593
<groupId>org.apache.maven.plugins</groupId>
575594
<artifactId>maven-surefire-plugin</artifactId>
576595
<configuration>
596+
<argLine>${surefireArgLine}</argLine>
577597
<systemPropertyVariables>
578598
<org.odftoolkit.odfdom.validation>true</org.odftoolkit.odfdom.validation>
579599
</systemPropertyVariables>

pom.xml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@
304304
<configuration>
305305
<!-- <forkCount>3</forkCount>
306306
<reuseForks>true</reuseForks>-->
307-
<argLine>-Dfile.encoding=${project.build.sourceEncoding}</argLine>
307+
<argLine>${surefireArgLine} -Dfile.encoding=${project.build.sourceEncoding}</argLine>
308308
<systemPropertyVariables>
309309
<odftoolkit.version>${project.version}</odftoolkit.version>
310310
<odftoolkit.git.branch>${git.branch}</odftoolkit.git.branch>
@@ -519,6 +519,47 @@
519519
</formats>
520520
</configuration>
521521
</execution>
522+
<!--
523+
Prepares the property pointing to the JaCoCo runtime agent which
524+
is passed as VM argument when Maven the Failsafe plugin is executed.
525+
-->
526+
<execution>
527+
<id>pre-integration-test</id>
528+
<phase>pre-integration-test</phase>
529+
<goals>
530+
<goal>prepare-agent-integration</goal>
531+
</goals>
532+
<configuration>
533+
<!-- Sets the path to the file which contains the execution data. -->
534+
<destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
535+
<!--
536+
Sets the name of the property containing the settings
537+
for JaCoCo runtime agent.
538+
-->
539+
<propertyName>failsafeArgLine</propertyName>
540+
</configuration>
541+
</execution>
542+
<!--
543+
Ensures that the code coverage report for integration tests is created after
544+
integration tests have been run.
545+
-->
546+
<execution>
547+
<id>post-integration-test</id>
548+
<phase>post-integration-test</phase>
549+
<goals>
550+
<goal>report-integration</goal>
551+
</goals>
552+
<configuration>
553+
<!-- Sets the path to the file which contains the execution data. -->
554+
<dataFile>${project.build.directory}/coverage-reports/jacoco-it.exec</dataFile>
555+
<!-- Sets the output directory for the code coverage report. -->
556+
<outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
557+
<formats>
558+
<format>XML</format>
559+
<format>CSV</format>
560+
</formats>
561+
</configuration>
562+
</execution>
522563
</executions>
523564
</plugin>
524565
</plugins>
@@ -542,6 +583,7 @@
542583
<directory>${project.basedir}</directory>
543584
<includes>
544585
<include>**/target/coverage-reports/jacoco-ut.exec</include>
586+
<include>**/target/coverage-reports/jacoco-it.exec</include>
545587
</includes>
546588
</fileSet>
547589
</fileSets>

taglets/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@
9797
</execution>
9898
</executions>
9999
</plugin>
100+
<plugin>
101+
<groupId>org.jacoco</groupId>
102+
<artifactId>jacoco-maven-plugin</artifactId>
103+
</plugin>
100104
</plugins>
101105
</build>
102106

validator/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
<groupId>org.apache.maven.plugins</groupId>
136136
<artifactId>maven-surefire-plugin</artifactId>
137137
<configuration>
138+
<argLine>${surefireArgLine}</argLine>
138139
<excludes>
139140
<exclude>**/IntegrationTest.java</exclude>
140141
<exclude>**/ITJarTest.java</exclude>
@@ -227,6 +228,7 @@
227228
<artifactId>maven-failsafe-plugin</artifactId>
228229
<version>2.22.2</version>
229230
<configuration>
231+
<argLine>${failsafeArgLine}</argLine>
230232
<includes>
231233
<include>**/IntegrationTest.java</include>
232234
<include>**/ITJarTest.java</include>
@@ -248,6 +250,10 @@
248250
</execution>
249251
</executions>
250252
</plugin>
253+
<plugin>
254+
<groupId>org.jacoco</groupId>
255+
<artifactId>jacoco-maven-plugin</artifactId>
256+
</plugin>
251257
</plugins>
252258
</build>
253259
<reporting>

xslt-runner/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@
307307
</execution>
308308
</executions>
309309
</plugin>
310+
<plugin>
311+
<groupId>org.jacoco</groupId>
312+
<artifactId>jacoco-maven-plugin</artifactId>
313+
</plugin>
310314
</plugins>
311315
</build>
312316
<profiles>

0 commit comments

Comments
 (0)