使用水豚运行并行硒测试
背景:
我有一组针对我的 Rails 3 应用程序运行的 Capybara 集成测试。对于测试套件的其他部分,我使用Rspec。
我的 Mac OSX 开发机器上有一个 selenium 2.6.0 独立服务器集线器。
java -jar selenium-server-standalone-2.6.0.jar -role hub
我正在运行多个虚拟机,每个虚拟机都通过一个 selenium 节点连接到集线器:
java -jar selenium-server-standalone-2.6.0.jar -role webdriver -hub http://0.0.1.12:4444/grid/register port 5555 -browser browserName="internet explorer",version=8,platform=WINDOWS
这工作正常,在此屏幕截图中,控制台显示我有一个 IE7 和一个 IE8 浏览器连接到集线器:
我已将水豚设置为针对 selenium 集线器运行(将测试委托给节点)。
Capybara.app_host = "myapp.dev"
Capybara.default_driver = :selenium
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app,
:browser => :remote,
:url => "http://localhost:4444/wd/hub",
:desired_capabilities => :internet_explorer)
end
它可以工作,但是它只会在单个 internet_explorer 节点上运行测试。似乎是“排在第一位”的;如果我将其关闭,测试将在另一个节点上成功运行。
我一直在尝试 parallel_tests 项目,按照建议配置水豚,但这仍然只会启动一个集成测试。
如何同时在所有 internet_explorer 节点上运行集成?
额外问题:如果我想在所有连接的节点上运行集成测试,无论浏览器功能如何,我将如何这样做吗?
Background:
I have a set of Capybara integration tests running against my Rails 3 Application. For the other parts of the test suite I'm using Rspec.
I have a selenium 2.6.0 standalone server hub on my Mac OSX dev machine.
java -jar selenium-server-standalone-2.6.0.jar -role hub
I'm running several virtual machines each hooked up to the hub with a selenium node:
java -jar selenium-server-standalone-2.6.0.jar -role webdriver -hub http://0.0.1.12:4444/grid/register port 5555 -browser browserName="internet explorer",version=8,platform=WINDOWS
This works fine, In this screenshot the console shows that I have an IE7 and an IE8 browser connected to the hub:
I've setup capybara to run against the selenium hub (that delegates the tests to the nodes).
Capybara.app_host = "myapp.dev"
Capybara.default_driver = :selenium
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app,
:browser => :remote,
:url => "http://localhost:4444/wd/hub",
:desired_capabilities => :internet_explorer)
end
It works, however it will only run the test on a single internet_explorer node. It seems to be the one that is "first in line"; If i turn it off, the test will successfully run on the other node.
I've been trying out the parallel_tests project, configuring capybara as suggested, but that would still only launch one integration test.
How can I run my integration on all internet_explorer nodes simultaneously?
Bonus question: If i wanted to run my integration tests on all connected nodes, regardless of browser capability, how would i do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在这里,您必须为不同的浏览器触发相同的测试,因此可以尝试启动两个测试过程,即运行相同的命令两次。
当您启动节点时,网格将处理不同节点上的执行。
在您的情况下,您正在执行测试,并且仅在套件/进程上相对于网格启动。仅出于测试目的,请尝试依次触发这些测试两次。如果您无法通过此方法实现,请使用 Ant 或类似的东西来控制测试的执行。
Here you have to fire the same tests for different browser so can try to start two process of tests i.e. Run the same command twice.
As you have started the nodes the Grid will handle the execution on different nodes.
In your case you are executing the test and only on suite/process is started with respect to Grid. Just for testing Purpose try firing these tests twice one after another. If you are not able to Achieve by this Use Ant or similar thing to control your execution of tests.
对于 IE webdrive,您最多可以在一个物理节点上运行 1 个测试!如果您想使用 IE webdriver 实现并行性,可以尝试向集线器添加/注册更多物理节点。
对于上面的 Hub 控制台屏幕截图,它也只显示了一个 IE 图标。该消息“支持最多 5 ....”是错误的,但您可以考虑其下方显示的各个浏览器的图标数量。
For IE webdrive you can run at most 1 test on one physical node! If you want to achieve parallelism with IE webdriver than you can try by add/register more physical node to the hub.
Regarding above screen shot of hub console, it also shows you only one IE icon. The message is wrong that "Supports up to 5 ...." but you can consider number of icon for respective browser displayed below it.