问题
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.
回答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.
来源:https://stackoverflow.com/questions/31108661/need-to-generate-code-coverage-reports-using-jacoco-exec-file