1

I have application war file deployed on Jboss 7 server. I able to generate jacoco.exec file by adding following JVM option

javaagent:/jboss/common/lib/jacocoagent.jar=destfile=/root/jacoco/jacoco.exec,includes=*,append=true,output=file

I want to have code coverage report generated automatically without using eclipse/ plugins.

Vicky Thakor
  • 3,847
  • 7
  • 42
  • 67
Ranjan Kumar
  • 107
  • 1
  • 10

1 Answers1

1

I am able to generate jacoco reports using following steps:

Step A: Modify / add JVM option in conf file ../jboss/bin/run.conf JAVA_OPTS=-javaagent:../jboss/common/lib/jacocoagent.jar=destfile=/opt/jacoco/jacoco.exec,includes=,excludes=org.,append=true,output=file

Step B:Copy jacocoagent.jar jar file in jboss lib directory ../jboss/lib/jacocoagent.jar

Step C: Perform manual testing

Step D: Shutdown Jboss instance. jacoco.exec file will get generated.

Step E: Write build.xml ant file to generate reports[html,csv,xml] based on .exec file , mentioning path for jacocoagent jar file

Step G: Run build.xml ant. This step will generate the report finally.

Ranjan Kumar
  • 107
  • 1
  • 10
  • Yes, that's the correct way. Btw, I use append mode as "false". I also denote jacoco.exec file in this case as either jacocoIT.exec (for Integraiton tests) or jacocoAT.exec (acceptance tests) or etc (jacocoST.exe for Selenium tests) as all these are kind of non-Unit tests (which require external resources for the tests to run). – AKS Jul 13 '15 at 17:32