How to append existing coverage report in new coverage report

2,483 views
Skip to first unread message

navee...@gmail.com

unread,
Aug 25, 2017, 6:10:42 AM8/25/17
to JaCoCo and EclEmma Users
How to append existing coverage report in new coverage report

Hi All,

I am working on application, where after every 2 hours we need to update the build means need to replace ROOT.war in tomcat/webapps.

Is there any way append existing report in new coverage report.

Changes in POM.xml:

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<configuration>
<skip>${maven.test.skip}</skip>
<!--<output>file</output> -->
<append>true</append>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>${project.build.directory}/target/jacoco.exec</destFile>
</configuration>
</execution>
<execution>
<id>jacoco-site</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>${project.build.directory}/target/jacoco.exec</destFile>
</configuration>
</execution>
</executions>

</plugin>

Changes in Catlina.sh: set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER% -javaagent:D:\jacoco-0.7.9\lib\jacocoagent.jar=destfile=D:\jacoco\jacoco.exec,append=true,includes=*,output=file

Please suggest if there is any way to do that

Marc R. Hoffmann

unread,
Aug 25, 2017, 9:33:46 AM8/25/17
to jac...@googlegroups.com
Hi,

it is not possible to merge already generated coverage reports.

But you can (re-)create a coverage report based on execution data from multiple runs. There are multiple ways to do this:
  • Merge multiple exec files into a single one (see merge goal)
  • Create the report with multiple exec files as input
  • Let the JaCoCo agent append exec data to a single file (this is how you already configured your agent)

However it is not possible to merge execution data when class files have been changed between the individual test runs.

Regards,
-marc

Naveen Gupta

unread,
Aug 25, 2017, 10:04:25 AM8/25/17
to jac...@googlegroups.com
Hi Marc,

Thanks for valauble advise, please review below mentioned pom.xml

</executions>undefined</plugin>undefined<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-surefire-plugin</artifactId>

<version>2.12.2</version>

<configuration>

                <includes>

                                <include>**/${testGroup}/*Test.java</include>

                </includes>

                <systemPropertyVariables>

                                <jacoco-agent.destfile>web/target/jacoco.exec</jacoco-agent.destfile>

                </systemPropertyVariables>

                <argLine>-Xms256m -Xmx2048m -XX:MaxPermSize=2048m</argLine>

</configuration>

</plugin>

 

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<version>3.2</version>

<configuration>

                <source>${java.version}</source>

                <target>${java.version}</target>

</configuration>

</plugin>


This is actually works for me.

Regards
Naveen




--
You received this message because you are subscribed to a topic in the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jacoco/mG6nkrcnVdE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/4f4a009c-a1da-117f-73da-a47e0ac52160%40mountainminds.com.

For more options, visit https://groups.google.com/d/optout.

Marc R. Hoffmann

unread,
Aug 25, 2017, 10:14:34 AM8/25/17
to jac...@googlegroups.com
Good to hear! Note that append=true is the default anyways.
-- You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/CA%2Bqs%2BRJqtNfLea1mSM9vRvZ6knaM5dJfM%2BBe12oFsUXEXKTiuw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages