Call us at (416) 850-2500 - Visit us at 639 Queen St. W, Suite 502, Toronto, Ontario M5V 2B7
Our Blog
TWG Talks
Business and Tech
Remember Rcov?
Rcov helps to identify code that is not being being hit by your tests (or maybe some functions left behind after refactoring). It’s very easy to get it running as well:
$ sudo gem install rcov
Plug this rake task into /lib/tasks/rcov.rake
require 'rcov/rcovtask'
namespace :rcov do
desc 'Measures test coverage using rcov'
Rcov::RcovTask.new(:test) do |rcov|
rcov.pattern = %w(test/unit/**/*_test.rb test/functional/**/*_test.rb test/integration/**/*_test.rb)
rcov.output_dir = 'rcov'
rcov.verbose = true
rcov.rcov_opts << '--exclude "gems/*"'
rcov.rcov_opts << '--rails'
end
end
namespace :rcov do
desc 'Measures test coverage using rcov'
Rcov::RcovTask.new(:test) do |rcov|
rcov.pattern = %w(test/unit/**/*_test.rb test/functional/**/*_test.rb test/integration/**/*_test.rb)
rcov.output_dir = 'rcov'
rcov.verbose = true
rcov.rcov_opts << '--exclude "gems/*"'
rcov.rcov_opts << '--rails'
end
end
And finally run it:
$ rake rcov:test
It’s so easy you have no excuse not to have it.
- Add Comment
- Filed under: Tech
[...] within the application code? This is accomplished using a code coverage analysis tool (such as Rcov), which can highlight those areas of the code-base untroubled by testing. Gates can be set as [...]