views:

359

answers:

1

I'm generating clover coverage reports (using Clover's maven plugin), and I'd like to exclude a certain package from the coverage reports (specifically, because it's UI code that intentionally isn't covered by my unit tests, but the reason doesn't really matter.)

I can see how to exclude that package from being instrumented (using in the plugin configuration), but I can't see how to exclude it from the report. The intended solution appears to be to use a Context; however, there is no package-level context available (only block, method, and statement.)

+2  A: 

As far as I know, excluding classes from instrumentation should exclude them from the report as well. Answers to the question #9 of this thread seem to confirm this:

9) Are their independent options for filtering at both the instrumentation level and at the reporting level?

Yes. The clover-setup takes a fileset of files to instrument. All clover-report tasks also take a fileset of sources to report coverage on. The clover-maven2-plugin provides includes/excludes at instrumentation time and full Ant fileset support for filtering at report time. Ant filesets give you all the power of fileset selectors to determine which files to include/exclude.

Could you try to do a full clean build (delete all previously compiled classes and all files in the Clover DB) to ensure that previously instrumented versions of your UI classes are removed and check again.

If this doesn't work, please run you build with the debug option (mvn -X > output.txt) and attach the output and your pom.xml to this question.

Pascal Thivent
I feel silly...this does work as you say it should. When I tried it before asking the question, I failed to clean my local working copy, causing it to pick up earlier results. The clean fixed it.
Jared