JavaAgent excludes

630 views
Skip to first unread message

Justin Morris

unread,
May 19, 2021, 11:02:33 AM5/19/21
to JaCoCo and EclEmma Users

To anyone who might know what's going on:

I am using the following options (edited for IP) to generate a report on a java application (the following is added to the applications' registry entry before I start my tests)

-javaagent:C:\jacoco\lib\jacocoagent.jar=destfile=C:\Temp\jacoco.exec,append=false,includes=packageroot.framework.app.*,excludes= packageroot.framework.app.installstuff.*: packageroot.framework.app.testingstuff.* ,output=tcpserver,port=6300

When my tests are complete, I then call the dump command, and run the report on the resulting file.

For whatever reason, the report shows the packages and classes I attempted to exclude.

Any help would be appreciated.

Regards
jmorris1501

Evgeny Mandrikov

unread,
May 19, 2021, 11:04:46 AM5/19/21
to JaCoCo and EclEmma Users

Why do I see classes in the coverage report although I excluded them in the JaCoCo agent configuration?

The includes and excludes options of the JaCoCo agent determine for which classes execution data is collected. Except for technical corner cases these options are normally not required. If you exclude classes, no execution data is collected for them.

Report creation is a separate step where all class files which should show up in the report are explicitly provided. Coverage is determined from the provided execution data. If execution data is missing for a particular class, this class is shown as not covered because the report generator cannot distinguish whether the class was excluded from instrumentation or not executed.

If you want to exclude classes from the report please configure the respective report generation tool accordingly. 

Justin Morris

unread,
May 19, 2021, 11:06:39 AM5/19/21
to JaCoCo and EclEmma Users
Thank you for the quick answer, and for being accommodating when there was something in the FAQ anyway.

Marc Hoffmann

unread,
May 19, 2021, 11:10:42 AM5/19/21
to jac...@googlegroups.com
Hi jmorris1501,

sure, see this FAQ entry:

Why do I see classes in the coverage report although I excluded them in the JaCoCo agent configuration?
The includes and excludes options of the JaCoCo agent determine for which classes execution data is collected. Except for technical corner cases these options are normally not required. If you exclude classes, no execution data is collected for them.
Report creation is a separate step where all class files which should show up in the report are explicitly provided. Coverage is determined from the provided execution data. If execution data is missing for a particular class, this class is shown as not covered because the report generator cannot distinguish whether the class was excluded from instrumentation or not executed.

If you want to exclude classes from the report please configure the respective report generation tool accordingly. 


--
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/2a1134e8-8c84-404e-8bcf-e521ae53ccdcn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages