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

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

问题描述

背景:

我有一组针对我的 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 开发机器上有一个 selenium 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

我正在运行多个虚拟机,每个虚拟机都通过一个 selenium 节点连接到集线器:

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 来运行 selenium 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

它可以工作,但是它只会在单个 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 节点上运行我的集成?

额外问题:如果我想在所有连接的节点上运行我的集成测试,而不管浏览器功能如何,我该怎么做?

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天全站免登陆