Need to generate Code Coverage Reports using jacoco.exec file

◇◆丶佛笑我妖孽 提交于 2019-12-20 05:25:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!