1

I'm trying to run WebDriver tests in parallel using testng.xml. I'm able to run testng tests in parallel by using parameter parallel="tests" but running with following paramters, "methods", "classes" is not working.

testng.xml

    <suite name="Suite1" verbose="1" parallel="methods" thread-count="5">
   <test name="Cart">
    <classes>
       <class name="com.tests1.Minus1">
       </class>       
    </classes>
   </test> 
  <test name="Checkout">
    <classes>
      <class name="com.tests2.AddA"/>
      <class name="com.tests2.AddB"/>
      <class name="com.tests2.AddC"/>
    </classes>
  </test>

  <test name="MBB">
    <classes>
      <class name="com.tests3.Mult1"/>
      <class name="com.tests3.Mult2"/>      
    </classes>
  </test>
</suite>

I tried with these versions 6.0.1, 5.9, 5.14.1, 6.3.1, 5.14.10, 5.10.0.1, 6.3, 5.14.6, 5.5. It didn’t seem to work. I also increased thread count to 100, but no behavior difference.

Can anyone please point out what I'm missing here?

Thanks

8
  • What happens now?
    – user246
    Commented Mar 20, 2012 at 1:26
  • Does it also not work when you use "-parallel methods" from command line?
    – Sam Woods
    Commented Mar 20, 2012 at 16:25
  • Actually I'm running these tests through Eclipse, so not using commandline. But I suspect that it won't run even through commandline. Right now, when I run tests they run sequentially instead of parallel if I use parallel=methods or parallel=classes. But runs in parallel for parallel=tests Commented Mar 20, 2012 at 17:13
  • A wild guess, Can you keep attribute, parallel="methods" at the test level instead of suite level and check?
    – Tarun
    Commented Mar 20, 2012 at 17:47
  • 1
    This might help - groups.google.com/forum/?fromgroups#!topic/testng-users/…
    – Tarun
    Commented Mar 22, 2012 at 6:18

3 Answers 3

3

Place this in your test or suite tag: preserve-order="false"

If this is not in there, parallel classes will not work.

0

I am not sure that I understand your goal. Using your testng.xml, when I ran with parallel='tests', each group of tests under a test tag ran sequentially, but the three test tags ran in parallel. Is that enough parallelism for you, or is your intent to run all six test classes simultaneously? If the latter, have you considered putting all six test classes under the same test tag?

0

For each suite you have to specify parallel="classes" and thread-count then testcases under that suite will run in parallel

Below is working testng.xml. u can give a try surely it will work since its working for me.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="classes" thread-count="2">
<test name="Test">
<classes>
  <class name="demo.suite.GoogleTest"/>
  <class name="demo.suite.YahooTest"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.