使用水豚进行平行硒测试 [英] Running parallel selenium tests with capybara

查看:82
本文介绍了使用水豚进行平行硒测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:

我有一组针对我的Rails 3应用程序运行的 Capybara 集成测试。对于测试套件的其他部分,我使用的是 Rspec

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.

我在Mac OSX上有一个硒2.6.0独立服务器中心开发机器。

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

这很好,在此控制台的屏幕快照显示了我已将IE7和IE8浏览器连接到集线器:

This works fine, In this screenshot the console shows that I have an IE7 and an IE8 browser connected to the hub:

我已经设置了capybara以针对硒集线器运行(将测试委托给节点) 。

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

但是,它将仅在单个internet_explorer节点上运行测试。似乎是第一批。如果我将其关闭,则测试将成功在另一个节点上运行。

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.

我一直在尝试 parallel_tests 项目,按建议配置水豚,但这仍然只会启动一个集成测试。

I've been trying out the parallel_tests project, configuring capybara as suggested, but that would still only launch one integration test.

如何在所有internet_explorer节点上同时运行集成? strong>

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?

推荐答案

在这里,您必须为不同的浏览器触发相同的测试,因此可以尝试启动两个测试过程,即运行相同的命令两次。

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.

在您的情况下,您正在执行测试,并且仅针对Grid启动套件/进程。仅出于测试目的,尝试一次又一次触发这些测试两次。如果您不能通过使用Ant或类似的方法来实现,以控制测试的执行。

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.

这篇关于使用水豚进行平行硒测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆