Selenium, Rails and rcov -- a solution and a question

Hi there,

We’ve been using rcov to generate coverage reports of our Selenium
specs, which is really nifty. We use this rake task:

namespace :selenium do
desc “Measure coverage of selenium specs”
task :coverage do
FileUtils.rm_rf “selenium_coverage”
mongrel_pid = fork { exec(“rcov script/server -o selenium_coverage
–rails – -e test -p 4000”) }
sleep(6) # wait for mongrel to start

begin # selenium will call "exit 1" if there are failures
  Rake::Task["selenium:spec"].invoke
rescue SystemExit; end

Process.kill("INT", mongrel_pid) # triggers generation of rcov 

report
Process.wait
system(“open selenium_coverage/index.html”) if PLATFORM[‘darwin’]
end
end


Unfortunately, the report does not include files that never get
touched, which is bad. The only solution I’ve come up with is having
Selenium hit a special controller action that requires all the files
in the app. This works, but is obviously kludgy. Other solutions I
tried all ran afoul of Rails’ load sequence. Anyone got bright ideas
on this?

Krishna