manicwave Surf the wave

Sharpening the code coverage saw

Here's a quick followup to my Hudson - Cocoa - Coverage Reporting blog post from the other day.

I didn't show the summary output that Cobertura displays in Hudson.  It looked like this:

Coverage before cleanup

You'll note (or I will do so for you) that there's a variety of packages here (in the cocoa case, these are just subdirectories of the current workspace).

Notwithstanding the anemic percentages of coverage overall, outside of the <default> and CDGenerated packages, these are all third party components. While I'm extremely interested in knowing that they work correctly, it's not on my radar to build out test coverage for each of these.

What I want is accurate reporting for the code that I write.

When we setup the gcovr build step in Hudson, the command looked like this:

/usr/local/bin/gcovr -r . -x -b -e /Developer  1> html/coverage.xml 2>/dev/null

The -e /Developer command line argument instructs gcovr to exclude any files with names that match /Developer.  The final config that I'm now working with is:

/usr/local/bin/gcovr -r . -x -b -e /Developer -e './UKKQueue/' -e './DebugUtils/' -e './Foundation/' -e './UnitTesting/' -e './Third Party Sources/' -e '.*/ShortcutRecorder.framework/' 1> html/coverage.xml 2>/dev/null

Which is obtuse at best, but works.  The '.*/xxx/' is necessary because the fully qualified path is processed by gcovr.  In my case it would be /Users/jschilli/.hudson/jobs/Tickets-MASTER/workspace/...

The results now look like this:

coverage chart after tweaks

The absolute measure of coverage for each of the two remaining packages has not changed, but the information is now focused on the data that is most important to me.

With all of that said, the exclusions you choose to add are project specific. Hopefully this will help you hone the reporting to your liking.