1

Im able to execute above suites sequentially but i want to parallel execution of these suites.

please find the xml 
 <suite name="Main suite"  > <!--commenting parallel="suite-file" thread-count="2"-->
    <suite-files>
        <suite-file path="suite1.xml" />
     <suite-file path="suite2.xml" />
      </suite-files>
    </suite>
vinay
  • 21
  • 1
  • 4

2 Answers2

4

Pls refer TestNG documentation here:

http://testng.org/doc/documentation-main.html#parallel-running

For running suites in parallel:

java org.testng.TestNG -suitethreadpoolsize 2 suite1.xml suite2.xml 

For running tests/classes/methods/instances define it in testng xml

<suite name="Main suite" parallel="methods/classes/tests/instances" thread-count="5">
parishodak
  • 4,506
  • 4
  • 34
  • 48
  • 2 questions: **#1** What will happen if for `java org.testng.TestNG -suitethreadpoolsize 10 suite1.xml suite2.xml `? Suite thread pool size is 10 but the suite files are just 2. **#2** Can the `thread-count in suite > suitethreadpoolsize`? – timekeeper Apr 22 '18 at 20:16
  • @AayushKumarSingha for #1 you are allocating 10 threads but only 2 are utilized. TestNG handles how many threads to be created based on the pending suites/tests/methods to be executed. This situation arises in normal cases as well. Think that you have 10 methods to execute and you have a thread pool size of 3, assuming all tests end at same time, you will have 1 method pending. TestNG will then close other two threads and operate on only one thread. After all methods are exhausted, threads will be closed. – parishodak Apr 23 '18 at 21:05
  • @AayushKumarSingha for #2 question, I haven't tried that configuration. My guess TestNG operates in SuiteThreadPools * Thread-count and creates that many threads. I usually don't go that route, but create multiple Jenkins jobs. Let me know here, if you try the configuration and any learnings from it. – parishodak Apr 23 '18 at 21:08
0

I have an answer to a similar question here that may be of some help to you. You're on the right track using the suite-of-suites XML configuration.

It's been quite some time since I've worked with this type of configuration, but what I posted in that answer was how I was able to get it to work in parallel. Other approaches likely exist, but hopefully this will get you started.

tim-slifer
  • 1,068
  • 1
  • 9
  • 17