0
votes

Actual - The behavior I see is that it runs all the tests in the class sequentially one session (FireFox browser) at a time on 1 node.

Expected - The class in this example "IntegrationTest" has 20 methods(@Test). I expect to see 5 tests in the class getting picked up, and run in parallel in 5 FireFox sessions on the 1 node.

Here's my testng suite file. Having thread-count as 1 makes sense as there's only 1 class I want to run.

<suite name="WebDriver Tests" parallel="classes" thread-count="1">
<test name="WebDriver Tests">
    <classes>
        <class name = "com.axiom.web.IntegrationTest" />
    </classes>
</test>

And here's the grid2 commands that I run on the hub and the node.

Hub command -

java -jar selenium-server-standalone-2.43.0.jar -role hub -browserTimeout 60

Node command -

java -jar selenium-server-standalone-2.43.0.jar -role node  -hub http://<host ip address>:4444/grid/register

Am I missing something here? What do I have to do to get maxSession work as it should? I believe maxSession takes precedence over maxInstances, but either way, specifying none, both or either in the node command didn't work for me. I am on Selenium version 2.43.1 and testng version 6.8.8.

Thanks and appreciate the help!

2

2 Answers

0
votes
  1. You need to configure the node with the number of FF sessions you want it to support.

See "Configuring the nodes" on this page - https://code.google.com/p/selenium/wiki/Grid2

  1. You need to increase the thread-count in the testng suite file and specify that you want parallel="methods".

parallel="classes" and thread-count=1 means you want one total thread and that you want all methods in each class to run on the same thread. parallel="methods" means you want each method to have it's own thread. However, a single thread won't accomplish what you want, so you need to add more total threads.

Documentation for thread-count and the parallel setting is here - http://testng.org/doc/documentation-main.html#parallel-running

0
votes

I will recommend you that add @BeforeMethod and have multiple driver instances being initialized in @BeforeMethod if you want to run in 5 browsers you will have to open 5 browsers i.e create 5 driver instances yourself in @BeforeMethod. Let me know if you need further help.