Reputation: 31
I am trying to generate a report on code coverage for my functional test cases of one module(java project). I am trying to do it from command line. Basically I run a shell script to run my application and I am adding the below arguments in the shell script so that I can create jacoco.exec file, which could be later converted to HTML report.
-javaagent:/root/jacoco/lib/jacocoagent.jar=destfile=/root/jacoco/data/jacoco.exec
Why is jacoco.exec file being created empty?
Upvotes: 3
Views: 5119
Reputation: 358
jacoco.exec is always creatd empty. It is filled on JVM exit.
Jacoco use shutdown hook to launch a dump of data in jacoco.exec.
Alternatively you can trigger a dump by exeucting the following :
Can I collect coverage information without stopping the JVM? Yes, there are two possible ways: The JaCoCo agent can be configured for remote control via TCP/IP sockets. This allows to collect execution data at any point in time from a running JVM. The dump Ant task or the dump Maven goal can be used to request dumps. The remote control feature also allows you to reset execution data.
Alternatively the JaCoCo agent can be configured to expose some functionality via JMX (jmx=true). The bean org.jacoco:type=Runtime provides operations to dump and reset execution data at any point in time
see more here : http://www.eclemma.org/jacoco/trunk/doc/faq.html
Upvotes: 3