1
votes

I am using TestNg + Selenium (JAVA) Grid to perform parallel execution.

My Machine\Server configuration is

  • Processor: Intel Xeon, CPU E5-2603 v4, 2.20 GHz ( 8 Processors)
  • RAM : 64 GB
  • System Type: 64 bit
  • OS : Window Server 2012 R2 Standard

I have HUB and 3 Nodes in this same machine

  • HUb Command : java -jar selenium-server-standalone-3.1.0.jar -role hub
  • Node Command : java -Dwebdriver.chrome.driver=./chromedriver.exe -jar selenium-server-standalone-3.1.0.jar -role node -hub http://localhost:4444/grid/register -browser browserName=chrome,maxInstances=20 -port 6661
    (Port no is 6661,6662 & 6663 for 3 different nodes.)

I have 100+ test cases with @Test TAG, but at a time only 10 test case getting executed parallel. I want to execute 50+ test at the same time . What am I missing ?
Thanks in advance.

1
Are you using the parallel attribute on the <suite> tag ? linkGregM
can you show how your testng xml look like? There is a way to set the number of thread count like this <suite name="SingleSuite" verbose="2" thread-count="50">Vladimir Efimov

1 Answers

2
votes

You set the number of parallel thread using the following config in your xml. So for example:

If you want to run your test methods in parallel (in this example MyTest class contains multiple @Test methods)

<suite name="mySuite" parallel="methods" thread-count="50">
  <test name="myTests">
    <classes>
      <class name="test.sample.MyTest1" />
    </classes>
  </test>     
</suite>

or

<suite name="mySuite" parallel="methods" thread-count="50">
  <test name="myTests">
    <packages>
      <package name="test.sample" />
   </packages>
 </test>
</suite>

If you want to run 50 threads for your 50 test classes (for this example 1 class = 1 test).

<suite name="mySuite" parallel="tests" thread-count="50">
  <test name="thread 1">
    <classes>
      <class name="test.sample.MyTest1" />
   </classes>
  </test>
  <test name="thread 2">
    <classes>
      <class name="test.sample.MyTest2" />
   </classes>
  </test>
   ...
  <test name="thread 50">
    <classes>
      <class name="test.sample.MyTest50" />
   </classes>
  </test>
</suite>

For other options, you can check out the TestNG doc: https://testng.org/doc/documentation-main.html#parallel-tests