Easy rcov with Test::Unit and Rails 2
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.