Revert that Rakefile!
To my slight embarrassment, I just noticed the following comments at the top of the Rails-generated So ignore my suggestion to edit your Combining the tips from the past couple of posts and tidying up a bit, mine looks like this:
Technorati tags: ruby rails coverage testing tdd rcoverage rcovRakefile:
# Add your own tasks in files placed in lib/tasks ending in .rake
# for example lib/tasks/switchtower.rake, and they will automatically be available to Rake
Rakefile, and create a lib/tasks/rcov.rake instead.
require 'rake/clean'
# output goes to subdirectories of this one
RCOV_OUT = "coverage"
# "rake clobber" to remove output directory (along with other generated stuff)
CLOBBER.include(RCOV_OUT)
# don't report coverage on these files
RCOV_EXCLUDE = %w(boot.rb environment.rb).join(',')
# RCOV command, run as though from the commandline. Amend as required or perhaps move to config/environment.rb?
RCOV = "/ruby/bin/ruby /ruby/bin/rcov --no-color --exclude #{RCOV_EXCLUDE}"
desc "generate a unit test coverage report in coverage/unit; see coverage/unit/index.html afterwards"
task :coverage_units do
sh "#{RCOV} --output #{RCOV_OUT}/unit test/unit_tests.rb"
end
desc "generate a functional test coverage report in coverage/functional; see coverage/functional/index.html afterwards"
task :coverage_functional do
sh "#{RCOV} --output #{RCOV_OUT}/functional test/functional_tests.rb"
end
desc "generate a coverage report for unit and functional tests together in coverage/all; see coverage/all/index.html afterwards"
task :coverage_all do
sh "#{RCOV} --output #{RCOV_OUT}/all test/all_tests.rb"
end
desc "equivalent to coverage_all"
task :coverage => [:coverage_all]

3 Comments:
I also excluded some additional testing files. It seemed like they were artifically inflating my numbers.
RCOV_EXCLUDE = %w(boot.rb environment.rb '.+_test\.rb$' test_helper.rb unit_tests.rb functional_tests.rb).join(',')
By
brian at swivel dot com, at 9:48 AM
I downloaded your rake file and was all set to run with it but I oculd not get it to run under windows XP. I did get rcov to run by itself outside of the rake just not in the rake. Do you have any ideas on how to get it to run?
By
Test, at 4:56 AM
if you pass --rails to rcov it skips config/, environment/ and vendor/
By
Jared, at 8:10 PM
Post a Comment
<< Home