所以,我已经开始创建一些使用Selenium RC直接在浏览器中测试我的Web应用程序的Ruby单元测试.我正在使用Selenum-Client作为红宝石.我已经为我继承的所有其他selenium测试创建了一个基类.
这会创建大量SeleniumDriver实例,并在每个实例上调用所有缺少的方法.这基本上是并行运行测试.
其他人如何自动化这个?
这是我的实施:
class SeleniumTest < Test::Unit::TestCase
def setup
@seleniums = %w(*firefox *iexplore).map do |browser|
puts 'creating browser ' + browser
Selenium::SeleniumDriver.new("localhost", 4444, browser, "http://localhost:3003", 10000)
end
start
open start_address
end
def teardown
stop
end
#sub-classes should override this if they want to change it
def start_address
"http://localhost:3003/"
end
# Overrides standard "open" method
def open(addr)
method_missing 'open', addr
end
# Overrides standard "type" method
def type(inputLocator, value)
method_missing 'type', inputLocator, value
end
# …Run Code Online (Sandbox Code Playgroud)