硒RC:自动多个浏览器运行测试 [英] Selenium RC: Run tests in multiple browsers automatically
问题描述
所以,我开始创建使用硒RC 来测试我的一些Ruby的单元测试直接Web应用程序在浏览器中。我使用红宝石 Selenum客户端。我创建了我所有的Selenium测试的基类来继承。
So, I've started to create some Ruby unit tests that use Selenium RC to test my web app directly in the browser. I'm using the Selenum-Client for ruby. I've created a base class for all my other selenium tests to inherit from.
这创建大量SeleniumDriver实例和所有缺少的号召每个实例的方法。这本质上运行测试并行。
This creates numerous SeleniumDriver instances and all the methods that are missing are called on each instance. This essentially runs the tests in parallel.
如何有其他人的自动化吗?
这是我的执行:
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
# Overrides standard "select" method
def select(inputLocator, optionLocator)
method_missing 'select', inputLocator, optionLocator
end
def method_missing(method_name, *args)
@seleniums.each do |selenium_driver|
if args.empty?
selenium_driver.send method_name
else
selenium_driver.send method_name, *args
end
end
end
end
这工作的,但如果一个浏览器失败,整个测试失败,也没有办法知道它没有哪个浏览器。
This works, but if one browser fails, the whole test fails and there is no way to know which browser it failed on.
推荐答案
你有没有尝试硒电网?我觉得它创建pretty很好的总结报告,显示你需要的细节。我可能是错的,因为我没有使用它相当长一段时间。
Did you try Selenium Grid? I think it creates pretty good summary report which shows details you need. I may be wrong, as I didn't use it for quite a while.
这篇关于硒RC:自动多个浏览器运行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!