I have to get the code coverage of a application while business test are executed from a different code base.
I use: Maven as my build Jbehave as my testing framework. T
I was able to resolve this as follows
Copy the application classes in to a instrumentation folder.
Start the app server (tomcat in mycase) with Java arguments
-javaagent:$WORKSPACE/target/lib/jacoco-agent-0.6.3.2.jar=includes=*,destfile=$TOMCAT_HOME/jacoco-coverage.exec,append=false
(I had the jacoco-agent jar copied in to my project at the layout)
Execute the tests (this can be automated or manual)
Stop the tomcat server (jacoco-coverage.exec
is updated at this point)
Execute ant report target. pointing the updated jacoco-coverage.exec and copied application class folder.
Reference: http://car-online.fr/en/blog/fabien_duchene/2013-05-03-Java%20Code%20Coverage%20in%20Tomcat%20JSP%20applications,%20e.g.,%20WebGoat%20with%20Jacoco/
Thanks @jens-schauder for pointing me to post this as the answer.