I'm pretty new to both Ruby and Selenium and I'm just trying to figure out the best way to build my test harness. I'm using Rake, Rake::TestTask, and Test::Unit to power this. I have a suite that I'd like to run once for each browser/os combination. I can't figure out how to parameterize my tests though, something I've become accustomed to with Junit4 and TestNG.
require 'rake'
require 'rake/testtask'
browsers = ['IE on Windows', 'Firefox on Windows', 'Firefox on Mac', 'Safari on Mac']
task :default => [:run_tasks]
task :create_tasks do
browsers.each do |browser|
Rake::TestTask.new("selenium_units:#{browser}") do |t|
t.libs << "lib"
t.pattern = 'test/*_test.rb'
t.verbose = true
t.warning = true
t.opts = "BROWSER=\"#{browser}\""
end
end
end
task :run_tasks => [:create_tasks]
task :run_tasks => browsers.map { |e| "selenium_units:"+ e }
I'd really like to be able to read that BROWSER= in the setup of my Suites or Cases. Any suggestions or is there plainly a better way of doing this in Ruby?