July 17, 2011 0

Hudson Code Coverage Reports for Ruby 1.9.2

By in Testing

Want to increase the value of your Hudson Reports with some test/code coverage data? For Ruby 1.8.7 there is a great plugin which uses metrics_fu to display reports within Hudson from Joseph Wilk. But in my case I wanted to use the latest Ruby-1.9.2 stable (in my case p136). The code analysis tools that metrics_fu uses are currently not compatible with 1.9.2, so I decided to use cover_me instead.

But how do you get the cover_me reports into Hudson? It’s actually very easy. Cover me comes with a Emma XML reporting formatter, that can generate XML coverage reports that you then can read with the Emma Hudson Plugin.

So here are the step-by-step instructions on how to configure Ruby 1.9.2-p136, cover_me 1.0.0.rc6, Hudson 2.0.1, Hudson Emma Plugin 1.25 and Rails 3.0.9

  1. Add the following to your Gemfile
  1. Run bundle install to install cover_me and it’s dependencies
  2. Now run the cover_me installer rails g cover_me:install
  3. Edit the cover_me rake tasks file to have it output the coverage reports in the Emma XML format.
  1. Commit your changes and login to your Hudson server.
  2. Configure your project and enable Emma Reports for your project.

Emma Report configuration in Hudson project configuration

  1. That’s it!

For your interest here is my bash-script for running rspec and cucumber with Hudson and generate the Emma Reports:

Tags: , , , , ,

Leave a Reply