kinghenry14
kinghenry14

Reputation: 1185

testNG/selenium webdriver limited to 5 parallel tests

I am running selenium webDriver with the maven surefire plugin and using testNG and have been able to parallelize my tests reusing one JVM instance. for some reason I am unsure how to run more than 5. I tried setting

<threadCountMethods> 10</threadCountMethods>

in the hopes that it would run 10 threads at a time rather than 5 which i thought may have been a default value.

I am parallelizing on methods, as shown here:

` org.apache.maven.plugins maven-surefire-plugin 2.17

        <configuration>
            <useUnlimitedThreads>true</useUnlimitedThreads>
            <threadCountMethods>10</threadCountMethods>
            <parallel>methods</parallel>
            <forkCount>0</forkCount>
            <reuseForks>true</reuseForks>
             <suiteXmlFiles>
                <suiteXmlFile>kingHenry.xml</suiteXmlFile>
            </suiteXmlFiles>
        </configuration>
      </plugin>`

and the suite file is configured as follows:

<suite name="Suite" parallel="methods" >
<parameter name="seleniumHost" value="192.168.1.74" />
<parameter name="seleniumPort" value="4444" />

<parameter name="logHost" value="localhost" />
<parameter name="logPort" value="5000" />
<parameter name="networklogging" value="false" />

<test name="Showdme">
    <parameter name="browser" value="phantomjs" />
    <classes>
        <class name="com.something.suites.kingHenry" />
        <methods>
            <include name="testScenario1" />
            <include name="testScenario2" />
            <include name="testScenario3" />
            <include name="testScenario4" />
            <include name="testScenario5" />
            <include name="testScenario6" />
        </methods>
    </classes>
</test>

</suite>

here i am showing that there are 6 methods listed to parallelize on, but in the image that is attached only 5 browser instances run at a time. I am wondering if i need to edit or add a config property in my pom.xml file or if there is a setting for the selenium grid that is being used that limits 5 instances of the chromedriver. any help would be appreciated... some of the documentation on threads/forking on the surefire plugin was a little bit confusing.

mvn-stackTrace1![][1]

Upvotes: 2

Views: 1659

Answers (1)

ddavison
ddavison

Reputation: 29032

If you are using a Selenium Grid, then it makes sense that your tests are being limited to 5 at a time. The factory Selenium Grid properties allow a grid to run:

WebDriver: - 5 Google Chrome - 5 Firefox - 1 IE

Legacy (RC): - 5 Google Chrome - 5 Firefox - 1 IE

You can change these values using a node configuration json file.

nodeConfig.json

{
  "capabilities":
      [
        {
          "browserName": "*chrome",
          "maxInstances": 2,
          "seleniumProtocol": "Selenium"
        }
        ... (any other browser capabilities here)
      ],
  "configuration":
  {
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "maxSession": 10,
    "port": 5555,
    "register": true,
    "registerCycle": 5000,
    "hubPort": 4444
  }
}

Then when running your nodes:

java -jar selenium-server-standalone.jar -role node -nodeConfig nodeConfig.json ...

Upvotes: 1

Related Questions