Links
Twitter
Flickr
« Programmers, factories and scaling our time. | Main | Git pull from github »
Wednesday
Sep302009

Add an rcov c0 code coverage threshold to your cc.rb build

Okay, you use rcov through metric_fu to measure your test code coverage. If you can't compile it at least you know your code doesn't throw run time syntax errors, right? All of it? Yeah... well, me neither. But I'm trying to get better and this is my technique for that.

Never take a step backwards. Fail your builds if the test coverage drops below where you're currently at.

Here's a rake task to fail the build if it drops out below a set threshold.

Add it to your lib/tasks folder in your rails app.

As you increase coverage update the threshold, treat that threshold like a ratchet, a notch of movement each time but always in the same direction.

I'm sure this is extensible to other metric_fu metrics too.



p.s., I'm very open to hearing a better way of doing this. I couldn't get any joy from the metric_fu mailing list so hacked this together. Surely there must be a better way?

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>