Monday
Feb012010
Easy rcov with Test::Unit and Rails 2
Monday, February 1, 2010 at 6:23AM
Yesterday, I needed test coverage numbers for an application using Rails 2.3 and plain old Test::Unit (still my test framework of choice). This proved to be a good deal more difficult than I expected: there are so many forks of the original rcov code, and so much disparate advice on how to get it hooked up, that I spent a great deal of unprofitable time reading before I got the right combination. Hopefully this short list will save you from doing the same:
- Install the relevance-rcov gem. This is the stable and maintained fork.
- Install the commondream rcov_plugin. This has the best set of working rake tasks I've found.
- Add coverage/* and test/coverage/* to your .gitignore.
- Run rake test:coverage to generate coverage results.
- Open /coverage/index.html in your project to view the results.
tagged
rails,
rcov,
testing in
Rails Articles
rails,
rcov,
testing in
Rails Articles 
Reader Comments (4)
You can now just install rcov (from gemcutter), since github stopped building gems. relevance-rcov is *rcov* on gemcutter.
Thanks Chad! Even simpler.
Yeah this had been a source of confusion to many, and although I had it working through google-fu, it's nice to read this post so you can keep in mind the versioning issues.
Thanks for the post, helped me get going with rcov and testunit!