Installing RCov by script

Code coverage analysis with RCov, next on my TODO :>
Another install script for your leisure…

OBSOLETE: gem install rcov works again!

wget http://rubyforge.org/frs/download.php/28270/rcov-0.8.1.2.tar.gz
tar -xf rcov-0.8.1.2.tar.gz
sudo ruby rcov-0.8.1.2/setup.rb
rm -rf rcov-0.8.1.2

svn cleanup
svn update
piston import http://svn.codahale.com/rails_rcov vendor/plugins/rails_rcov

Now you can get started with rake test:units:rcov

Unit test results

  • Show only selected parts: SHOW_ONLY=m,l,c,v //model,lib,controller,view
  • Run single tests: rcov FILE -exclude “/var/|/usr/” –rails (irgnore /var and /usr folder)
  • Add RCov parameters: RCOV_PARAMS=””
  • exclude RCOV_PARAM=”–exclude ‘var/*,gems/*'”
  • Sort by coverage: COV_PARAMS=”–sort=coverage”
  • Hide fully covered: RCOV_PARAMS=” –only-uncovered”
  • If you see something like (eval):580:in `attribute’: wrong number of arguments (2 for 0) (ArgumentError) it means one of your tests is uncoverable, this can happen while using SQS gem

Add the RCOV_PARAMS to spec/rcov.opts (or test/rcov.opts)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s