Hi,
I am trying to get code coverage for my maven project using jacoco agent. My server code and test code is separate code bases. So I thought jacoco agent is helpful in getting the code coverage.
Jar is added into the dev code server and also added java arguments like below:
-javaagent:lib/org.jacoco.agent-0.8.1.jar=destfile=./coverage/jacoco.exec,output=tcpserver,address=*,port=6400 \
Restarted the server and make sure 6400 is upon running with jacoco agent.
In my test code, in pom file I added the code like below to generate the coverage report. But I am getting an error saying connection refused like below. Can some one Pl help me in fixing this issue and generating the coverage report
[INFO] Connecting to server name
[INFO] Connection refused (Connection refused)
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<configuration>
<address>provided the server address here</address>
<destfile>coverage/jacoco.exec</destfile>
<port>6400</port>
<reset>false</reset>
<append>true</append>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-dump</id>
<goals>
<goal>dump</goal>
</goals>
</execution>
<execution>
<id>jacoco-check</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>jacoco-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>jacoco-instrument</id>
<phase>test</phase>
<goals>
<!-- <goal>instrument</goal>-->
<goal>report</goal>
</goals>
<configuration>
<skip>false</skip>
</configuration>
</execution>
</executions>
</plugin>