开发者

Running parallel selenium tests with capybara

开发者 https://www.devze.com 2023-04-08 03:51 出处:网络
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.

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:

Running parallel selenium tests with capybara

I've set开发者_开发问答up 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?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号