Ruby on Rails Code Coverage

I realized that I would need to track my progress over time and began looking for a code coverage tool for Ruby on Rails. It did not take me long to find the coverage tool. However, coverage states that they are not making any changes and that rcov is better. I checked out rcov and it is pretty sweet and easy to use.

It replaces the command line invocation you would normally use to execute your tests and outputs the results as HTML into a coverage directory in your project. It is as easy as executing

rcov test/**/*.rb

to execute all of your tests and then browse the coverage directory with your favorite browser (i.e., Firefox).

If you are in the market for a free, easy to use code coverage utility for Ruby on Rails, I suggest rcov.

To install coverage

sudo gem install coverage

To install rcov

sudo gem install rcov

Posted January 24th, 2007 at 6:44 pm in Ruby on Rails | Permalink

Leave a response: