Code Coverage with groovy

1,041 views
Skip to first unread message

Sandra Gerberding

unread,
Mar 16, 2016, 8:36:11 AM3/16/16
to JaCoCo and EclEmma Users
Hi,

we will check code coverage in our grails project. 
Grails 3.1.2, Groovy 2.4.6, Gradle 2.6, Java 1.7, IDEA 

When we check code coverage in IDEA with jacoco we have a coverage of 100% for all our services, with the gradle plugin 78% because the standard Object methods (wait, notify...) are included in the check/report.
Is there a way to exclude these methods? 

best regards 
Sandra 

Marc Hoffmann

unread,
Mar 16, 2016, 1:39:40 PM3/16/16
to jac...@googlegroups.com
Hi,

JaCoCo does not yet support exclusion of specific methods.

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/5585506d-9f56-490a-af5b-1a42c7c0cf33%40googlegroups.com
> [1].
> For more options, visit https://groups.google.com/d/optout.
>
>
> Links:
> ------
> [1]
> https://groups.google.com/d/msgid/jacoco/5585506d-9f56-490a-af5b-1a42c7c0cf33%40googlegroups.com?utm_medium=email&utm_source=footer

Sandra Gerberding

unread,
Mar 17, 2016, 6:24:11 AM3/17/16
to JaCoCo and EclEmma Users
Hi, 

exclusion of specific methods is not what we would like to do. What we would like JaCoCo should do, is the exclusion of standard Java Object methods (equals, wait, notify...) and standard Groovy methods, that are added to all Objects. This seems to be possible since executing tests using IntelliJ IDEA while collection coverage data using JaCoCo as code coverage library does exactly what we expect: only the methods of our classes under tests are shown in the coverage report. It would be very nice, if JaCoCo code coverage would behave the same when starting the same tests using gradle.
We ask ourself: why do the code coverage reports behave differently when executed from within IntelliJ IDEA and from within gradle? Do You have an answer to this?

Best regards,
Sandra

Marc R. Hoffmann

unread,
Mar 17, 2016, 10:56:15 AM3/17/16
to jac...@googlegroups.com
Hi Sandra,

ok, for Groovy methods we have a filter on out list of use cases: https://github.com/jacoco/jacoco/wiki/FilteringOptions

But this is not yet implemented in JaCoCo.

The JaCoCo backend is primarly a Java API. We have a couple of third-party integrations like for IntelliJ. Maybe they implemented some filtering on their own. Would be nice to leran more about this, maybe they can contribute back zu JaCoCo.

Also are you sure you're actually using JaCoCo in IntelliJ? They also have their own coverage engine.

Regards,
-marc

For more options, visit https://groups.google.com/d/optout.


-- 
Marc Hoffmann
hoff...@mountainminds.com
_______________________________________________
Mountainminds GmbH & Co. KG

Nussbaumstr. 4 * 80336 Muenchen * Germany 
Phone/Fax +49-700-68664637 * 0700-MTNMINDS

Registergericht Muenchen * HRA 80201
Mountainminds Verwaltungs GmbH
Registergericht Muenchen * HRB 143183
Geschaeftsfuehrer Marc Hoffmann
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages