3

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?

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.