문제

I have read, that using grid, we can distribute tests across multiple nodes.

Say I have 4 test cases and 2 nodes(both have same configuration, platform:window, browser:firefox and maxSession=1, maxInstances:1) I was expecting 2 test cases to run on node 1 and 2 on node 2.

But when I run I see all 4 test cases run on either node 1 or node 2, based on who registers last. I have both registered to bug on different ports.

Is my understanding correct of running 2 test per node, or is this not possible.?

How do you achieve distributed testing for WebDriver?

도움이 되었습니까?

해결책

I think what you mean is parallel execution (which is distributed testing)? Selenium grid will provide the architecture to run these tests in a distributed fashion (i.e. distribute the test execution across multiple nodes), but you still need to trigger these tests in parallel.

Currently your tests are triggered sequentially, so the Selenium Grid Hub utilizes the first available node it gets, which happens to be the first one each time (for obvious reasons).

To quickly visualize how selenium grid can benefit with parallel execution, open 4 command prompts/terminals and in each trigger 1 of the 4 tests. If you have only 2 nodes and each node can only run one browser, you will see

  • Node A - Test 1
  • Node B - Test 2
  • Waiting for a free/available node {Test 3 and Test 4}

Then depending on which test (1 or 2) finishes executing first that node gets free and Test 3 will start on that node.

Of course you need to programmatically trigger these tests in parallel.


In python you could use nose and trigger your test run like so :-

nosetests --processes=2 allmytests #Starts 2 processes
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top