1

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?

1 Answer 1

4

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.