regardin .exec generation by jacoco java agent and report

610 views
Skip to first unread message

Saket Kumar

unread,
Sep 15, 2015, 8:19:25 AM9/15/15
to JaCoCo and EclEmma Users
Hi,

I am working on code coverage tools so working on jacoco implementation. Mainly i am curious about java agent that gave code coverage on the fly.I have java agent version
0.7.5 .I did the setup of it on my system.So when i gave java agent as a parameter to server startup and after doing manual testing of my application it generated .exec file
at specified location.But some time after i stop my server .exec file does not populated.And more about jacoco report part it shows report which have coverage for class that has not being used while manual testing.Report part seems a bit confusing and wrong detail being showing.
Please help me on to this because i do not see elaborated documentation of Jacoco on web.It seems like it behave unexpectedly.

Thanks,
Saket

Marc Hoffmann

unread,
Sep 15, 2015, 10:29:17 AM9/15/15
to jac...@googlegroups.com
Hi Saket,

the JaCoCo agent always creates an empty exec file at startup to ensure
the location is writable.

To actually dump coverage data into the exec file the JVM running the
test must properly shut down. If you i.e. just kill the process the
agent cannot write out execution data.

Another common mistake is invalid includes/excludes configuration.

Actually there is documentation available for JaCoCo:
http://www.eclemma.org/jacoco/trunk/doc/

Regards,
-marc
> --
> You received this message because you are subscribed to the Google
> Groups "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jacoco+un...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jacoco/5ee95ccd-7d96-4daf-98d9-085ff6bf4efa%40googlegroups.com
> [1].
> For more options, visit https://groups.google.com/d/optout [2].
>
>
> Links:
> ------
> [1]
> https://groups.google.com/d/msgid/jacoco/5ee95ccd-7d96-4daf-98d9-085ff6bf4efa%40googlegroups.com?utm_medium=email&utm_source=footer
> [2] https://groups.google.com/d/optout

Saket Kumar

unread,
Sep 16, 2015, 2:44:08 AM9/16/15
to JaCoCo and EclEmma Users
Hi,

I know .exec file generated at server startup that used to be empty.I face problem in JVM shutdown only.When i run my local apache  server from its GUI window it
create that empty .exec file but after i stop apache service from GUI window .exec does not get populated.
So, i tried to run Tomcat from command line by "Tomact7.exe //TS//" command it also generate .exec at start and when i stop this tomcat service by CTRL+C it populate that .exec file. But when i test my application for more time and then stop my service it does not populate that service.

My main problem is how to stop my JVM properly when i stop it from Tomcat GUI window.

Report part of Jacoco is not that accurate what i observed. Many packages that not been called from my app showing 1-2% of coverage. Please help me into this.
I read all its documentation followed the same but its not as per expected.

Thanks,
Saket

samvinc...@gmail.com

unread,
Sep 17, 2015, 10:55:53 AM9/17/15
to JaCoCo and EclEmma Users
Hi Marc,

Its mainly about Jacoco javaagent lib that i am using for coverage.I need some assistance from you regarding JVM proper termination to collect .exec
file data. I tried every way like
1) Start server from Apache GUI window and send java agent as parameter. My app.
start properly shutdown properly but .exec file still 0 byte.
2)I tried to start server from command line as console application. But some time .exec file populate and some time don't depend on time constraint. I stop my server from command line using CTRL+C .

So,please clear it like what is proper way to stop my JVM when i am using Jacoco javaagent on fly for automation test.

Thanks,
Saket

Marc R. Hoffmann

unread,
Sep 17, 2015, 3:36:31 PM9/17/15
to jac...@googlegroups.com
Hi Saket,


> My main problem is how to stop my JVM properly when i stop it from Tomcat GUI window.

You better direct this question to the Tomcat project. If JVM shutdown does not work for you JaCoCo offers two alternatives for you to dump coverage data before the JVM exits.

1) You can enable JMX (jmx=true) and use for example the JConsole to trigger execution data dump before you shutdown tomcat
2) Instead of file output JaCoCo offers e.g. a tcpserver output mode where coverage data can be requestes by a remote client (JaCoCo offers Ant task, Maven goal or API for this).

Regards,
-marc
--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.

Marc R. Hoffmann

unread,
Sep 17, 2015, 3:38:44 PM9/17/15
to jac...@googlegroups.com
> Report part of Jacoco is not that accurate what i observed.
> Many packages that not been called from my app showing 1-2% of coverage.

Hard to say wihtout drilling down the actual report. My guess would be that even if you don't use that functionality still some initializers are called e.g. due to static dependencies.


Regards,
-marc

On 16.09.15 08:44, Saket Kumar wrote:
--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.

Evgeny Mandrikov

unread,
Sep 17, 2015, 7:10:41 PM9/17/15
to JaCoCo and EclEmma Users, samvinc...@gmail.com
Hi,

The Java virtual machine shuts down in response to two kinds of events:
  1. The program exits normally, when the last non-daemon thread exits or when the exit (equivalently, System.exit) method is invoked, or
  2. The virtual machine is terminated in response to a user interrupt, such as typing ^C, or a system-wide event, such as user logoff or system shutdown.
So that for usual application "Ctrl-C" should work just fine. So that in your case would be better to consult with Tomcat documentation about process of server termination and shutdown hooks.

Best regards 

Saket Kumar

unread,
Sep 18, 2015, 7:38:58 AM9/18/15
to JaCoCo and EclEmma Users
Hi,

I want to know from your development point of view like where you were developing this plugin how you confirm that  your generated report are accurate to this extent . I want to know were you satisfied with the accuracy of report at that time. Because currently your generated report does not justify me. I want to know how did u checked your report accuracy at that time.

Thanks,
Saket

Marc Hoffmann

unread,
Sep 18, 2015, 8:04:38 AM9/18/15
to jac...@googlegroups.com
Hi,

JaCoCo has a extensive set of integration tests to verify the
correctness of the coverage result:


https://github.com/jacoco/jacoco/tree/master/org.jacoco.core.test/src/org/jacoco/core/test/validation

If you think you identified a problem please post a specific example
(screen shot of coverage report with highlighted source code).

Regards,
-marc
> --
> You received this message because you are subscribed to the Google
> Groups "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jacoco+un...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jacoco/c5b4f3b8-bf98-431e-b7a3-8fcc69380700%40googlegroups.com
> [1].
> For more options, visit https://groups.google.com/d/optout [2].
>
>
> Links:
> ------
> [1]
> https://groups.google.com/d/msgid/jacoco/c5b4f3b8-bf98-431e-b7a3-8fcc69380700%40googlegroups.com?utm_medium=email&utm_source=footer
> [2] https://groups.google.com/d/optout

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages