I am using jacoco
agent to generate my coverage reports in the form of xml
files by running the command:
java -jar <path>/sample_projects/beta/jacoco-code-coverage/jacoco-code-coverage-example/src/main/resources/lib/jacococli.jar report <path>/sample_projects/beta/jacoco-code-coverage/jacoco-code-coverage-example/target/jacoco-it.exec --classfiles <path>/sample_projects/beta/jacoco-code-coverage/jacoco-code-coverage-example/target/classes/com --sourcefiles src/main/java/ --xml <path>/sample_projects/beta/jacoco-code-coverage/jacoco-code-coverage-example/target/report.xml
This basically writes to jacoco-it.exec
file and it saves previous coverage data as well.
But I want coverage analysis per request made, is there any way I can erase previous data collected by jacoco agent.
So basically I got the solution just reset the exec dump at my middleware after the request has been made in this order I am able to get the coverage analysis per request.
ExecDumpClient execDumpClient = new ExecDumpClient();
execDumpClient.setReset(true);
execDumpClient.dump("localhost", 36320);