Reputation: 3156
I have a Java web application running on a Wildfly 9 server and I use the jmeter-maven-plugin to run some performance tests on the running instance of my application. Those tests run simple REST requests to my application's services.
What I would like to do is retrieve the code coverage statistics of the performance tests so that I always know what is the amount of covered code of my performance tests.
Following this, this and this StackOverflow threads I setup the JaCoCo Java agent on the server. This is the agent configuration at startup
set "JAVA_OPTS=%JAVA_OPTS% -javaagent:/path/to/jacocoagent.jar=output=tcpserver,address=*,port=6300,includes=my.package.*"
Also, I configured the jacoco-maven-plugin on the tests Maven project in order to let it run a dump on the server to retrieve the execution information.
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<configuration>
<destFile>${sonar.jacoco.itReportPath}</destFile>
<append>false</append>
</configuration>
<executions>
<execution>
<id>jacoco-dump</id>
<phase>verify</phase>
<goals>
<goal>dump</goal>
</goals>
<configuration>
<address>my.server</address>
<skip>${skipJMeterTests}</skip>
<!-- <reset>true</reset> -->
</configuration>
</execution>
</executions>
</plugin>
So, when I run mvn verify
all performance tests run (so the REST services are indeed called) and the JaCoCo plugin correctly dumps the server jacoco.exec file, but when I inspect this file running mvn sonar:sonar
I get a 0% coverage of code even though the services were called by the performance tests.
What could be the problem? I tried different configurations of the agent and plugin but seemed to not solve my problem.
Thank you
Upvotes: 1
Views: 1802
Reputation: 3156
Solved, I was not using the same version of the software on both server and test side
Upvotes: 1