Exclusion of code pieces like blocks/methods from code coverage

984 views
Skip to first unread message

Asanke Galgomuwa

unread,
May 4, 2016, 8:51:54 PM5/4/16
to JaCoCo and EclEmma Users
Is there a way to exclude a code block / a methods in the application code being evaluated for coverage.

I initial problem of mine associated with a code block with reflection, which triggers to fail the test because of the synthetic members of the jacoco.

I know that the code fix of check for the synthetic members will clear the issue, but I am currently not in a position to change the application code.


I have two options in mine, but not sure it is possible

[A] exclude the specific code block of the application (in the code bloc level or in the method level). This has to be done without a change in the application code.

[B] Exclude the test method being executed with Jacoco. Obviously moving the test in to a different test suite(which do not run code coverage ) is an option , I am interested in more ides.

I am running my test test on JUnit, Build using ant, and code coverage by Jenkins Jacoco plugin.

Marc R. Hoffmann

unread,
May 5, 2016, 1:25:46 AM5/5/16
to jac...@googlegroups.com
Hi,

as of today you can only exclude on class level.

Anyways, I don't think what you're suggesting will solve your problem: Your code probably fails because it reflects instumented classes. So you don't have to exclude the code doing reflection. Instead you woud need to exclude which are processed by this 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/694e2a01-6435-4e38-932a-a86fc65c5d21%40googlegroups.com.
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

Asanke Galgomuwa

unread,
May 6, 2016, 1:19:09 AM5/6/16
to JaCoCo and EclEmma Users
Hi Marc,

Yeah.. I guess at this moment , I need to run the test in a different test suite.

Thanks for the reply!

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