Monday, November 19, 2007

Unveiling NCoverCop

Duncan Bayne (who I have the pleasure of working with at the moment) had the idea of writing a small exe to parse an NCoverResults file and fail a build if the coverage drops below a set threshold. I loved it... and decided to up the ante.


From that seed I have built NCoverCop.

NCoverCop is a custom NAnt task that not only fails your build if your coverage drops, but lifts the threshold each time a new build passes with a higher threshold.

It works by keeping a copy of the best coverage file.

Here's how I use it..


  
coverageFile="${ncover.output.filename}"
previousCoverageFile="${ncover.backup.filename}"
minCoveragePercentage="65"
autoUpdate="${environment::get-machine-name() == debug.buildbox.name}"
/>


  • coverageFile is the location of the NCoverResults.xml file you want to compare.

  • previousCoverageFile is the file that will be overwitten if a successful build beats the current threshold.

  • minCoveragePercentage is used when you don't have a previousCoverageFile yet or the specified percentage is higher than that of the previousCoverageFile.

  • autoUpdate can be turned off so the previousCoverageFile doesn't get updated in a passing build.[defaults to on]



Here are a few tips...

We have the previousCoverageFile in a location that is visible on the network and referenced in the build file through it's network address. Coupled with being able to turn autoUpdate off for everyone except the build machine means that you can run ncoverCop locally and see if you are going to break the build before you check in.

3 comments:

Duncan Bayne said...

Hey, cool :-) I went Googling to see if SourceForge had accepted NCoverCop, & found this post. Google works its magic fast :-)

FYI the SOLO URL is my personal blog which will shortly be moving (at my request) after a tiff with the site owner. Hopefully I will be able to get my old personal Blogger site back from the spammer who took it after I moved to SOLO ...

My professional blog covering IT & software development is at fluidscape.co.nz, which has to my surprise turned into a mecca for people trying to get unsupported PalmOS devices going on Vista. The internet is a strange, strange place ...

Anonymous said...

Please can someone provide an example config to place in my build file. I can't find an example anywhere. Sourceforge says check the release notes which I can't find either. Any help appreciated.

Nigel Thorne said...

Take a look here...

http://sourceforge.net/project/shownotes.php?group_id=209906&release_id=554317

GitHub Projects