简体   繁体   中英

how to get automation test coverage in jacoco?

I am having my web application running on tomcat , and in separate project i have my test cases which calls all apis of my app , now i want to check code coverage , covered during api calls from automated test suit.

Steps I followed:

  1. jacoco dependency in pom.xml of my web app.
  2. downloaded jacocoagent.jar
  3. set JAVA_OPTS in catalina.sh export JAVA_OPTS="$JAVA_OPTS - javaagent:/tmp/jars/jacocoagent.jar=destfile=/tmp/jars/jacoco.exec,output=file"
  4. after all apis killing tomcat
  5. copying jacoco.exec file
  6. creating html report

but still getting zero coverage , have i missed any thing please suggest

你可以试试这个吗

JAVA_OPTS="$JAVA_OPTS -javaagent:/tmp/jars/jacocoagent.jar=includes=*,destfile=/tmp/jars/jacoco.exec,append=true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM