0
votes

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

1
Did you try the jacoco maven plugin? - C-Otto
yes to create html from exec file - Avinash Garg

1 Answers

0
votes

Can you try this ,

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