Aggregated RSpec/Cucumber test coverage with RCov

Updated . Posted . Visible to the public.

With defaults, RCov doesn't work the way you how you would like it to. To create a nice test coverage report, copy the attached file to lib/tasks/rcov.rake. After that rake rcov:all will run all RSpec examples and Cucumber features. The report will be written RAILS_ROOT/coverage/index.html.

Here is what the task does in detail:

  • Generates aggregated coverage of both RSpec and Cucumber
  • Works with Rails 2 and Rails 3
  • Reports for app/**/*.rb and nothing else
  • If called with an environment variable IGNORE_SHARED_TRAITS=true it ignores Modularity Show archive.org snapshot traits in app/controllers/shared and app/models/shared (which may or may not be entirely correct for your case).
  • Tested that it works with Selenium features
  • Doesn't add rake tasks outside development environment
Martin Straub
Last edit
Attachments
License
Source code in this card is licensed under the MIT License.
Posted by Martin Straub to makandra dev (2010-08-25 13:56)