Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Jenkins to exclude entire folders from code coverage?

I'm trying to figure out how to exclude a list of folders from the code coverage report generated by jacoco, which is launched by Jenkins.

It seems possible to exclude classes, but not folders, which is annoying for me as I've started using a pretty big library for an online payment system. Running those unit tests means constantly creating test accounts on that platform and having to delete them again. Every single tine Jenkins runs.

And it would be far simpler to just have the folders excluded than having to exclude every single one of the classes.

like image 360
KdgDev Avatar asked Jun 06 '14 08:06

KdgDev


1 Answers

To exclude entire directories by changing the Jenkins JaCoCo plugin configuration you would need to add an entry to the 'Exclusions' field.

For instance, if you want to exclude any files under any directory named 'test' you would add the following exclusion:

**/test/**

Keep in mind that if you want to add multiple exclusions you have to separate each one by a comma and there can be no spaces (due to a bug with the plugin).

Here is my JaCoCo plugin configuration: Example JaCoCo Plugin Configuration

like image 99
lax1089 Avatar answered Sep 18 '22 00:09

lax1089