How to execute more than 1 xml file in PARALLEL with TestNG

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: How to execute more than 1 xml file in PARALLEL with TestNG

kishore.chokkalingam


On Friday, November 13, 2015 at 12:22:49 PM UTC+5:30, Krishnan wrote:
Sayeed,

That error message is self explanatory. Please ensure that the name attribute of your <suite> tag all have unique names and that there are no duplications. That should fix your problem.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/
My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

On Thu, Nov 12, 2015 at 3:34 PM, MCK <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="TmPU0QsiAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mcka...@...> wrote:
Hi Manoj, 

I used the same below code but i get the following error

Two suites cannot have the same name: Test, where as both sub xml have different suite name, What i Observe is it all the iteration it is picking only first xml and it throws this error.

testng.setXmlSuites((List <XmlSuite>)(new Parser("G:\\ManojKS\\Eclipse workspace\\Test1.xml").parse())); Is this line iterates all xmls properly

Any help on this is really appreciated

Thanks and Regards,
Sayed MCK

On Thursday, 9 August 2012 01:51:35 UTC+5:30, Manoj Kapuganti wrote:
Hello Tim,

Thank you so much for your help.

Now I am able to execute multiple xml files in parallel.

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.xml.Parser;
import org.testng.xml.XmlSuite;
import org.testng.TestNG;
import org.xml.sax.SAXException;

public class MultipleXmls{

public static void main(String[] args) throws FileNotFoundException, ParserConfigurationException, SAXException, IOException {
TestNG testng = new TestNG(); 
testng.setXmlSuites((List <XmlSuite>)(new Parser("G:\\ManojKS\\Eclipse workspace\\Test1.xml").parse()));
testng.setSuiteThreadPoolSize(3);
testng.run();
    }
}

In Test1.xml content is

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "<a href="http://testng.org/testng-1.0.dtd" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\46sa\75D\46sntz\0751\46usg\75AFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Ftestng.org%2Ftestng-1.0.dtd\46sa\75D\46sntz\0751\46usg\75AFQjCNFHihXzQ1YlwcxcDehnw97TuniFLA&#39;;return true;">http://testng.org/testng-1.0.dtd">
<suite name="All Suites"> 
  <suite-files>
  <suite-file path="G:\ManojKS\Eclipse workspace\systemSettings\atest1.xml" />
  <suite-file path="G:\ManojKS\Eclipse workspace\systemSettings\atest2.xml" />
  <suite-file path="G:\ManojKS\Eclipse workspace\systemSettings\atest3.xml" />
  </suite-files>
</suite>

Thank you so much for your help again.

Best Regards,
Manoj Kapuganti

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="TmPU0QsiAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="TmPU0QsiAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@....
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;http://groups.google.com/group/testng-users&#39;;return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.


Hi It worked for me ,try the below code

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

import javax.xml.parsers.ParserConfigurationException;

import org.testng.xml.Parser;
import org.testng.xml.XmlSuite;
import org.testng.TestNG;
import org.xml.sax.SAXException;

public class MultipleXmls {
public static void main(String[] args){
try{
TestNG testng = new TestNG(); 
testng.setTestSuites(Arrays.asList(new String[] {"D:/Auto/two/src/two/main.xml"}));
testng.setSuiteThreadPoolSize(2);
testng.run();
}catch(Exception ex){
ex.printStackTrace();
}
    }

}
 

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to execute more than 1 xml file in PARALLEL with TestNG

Mohan Kumar
Hi All,

I am facing the same problem, when I have single test in two testng.xml(testng1.xml & testng2.xml) files means, browsers are launched simultaneously. 

But when I have more than one test in two testng.xml files means, testng2.xml file gets triggered only after testng1.xml file gets completed. 

Please check the below example.

testng1.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="Parallel suite 1" >
  <test name="Functional_Test_1">
   <parameter name="browser" value="Chrome" />
    <classes>    
      <class name="com.simpletest.sample1"/>
    </classes> 
  </test> 

   <test name="Functional_Test_2">
    <classes>    
       <class name="com.simpletest.sample2"/>
     </classes> 
  </test> 
</suite>

testng2.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="Parallel suite 2" >
  <test name="Functional_Test_3">
   <parameter name="browser" value="Chrome" />
    <classes>    
      <class name="com.simpletest.demo1"/>
    </classes> 
  </test> 

   <test name="Functional_Test_4">
     <classes>    
       <class name="com.simpletest.demo2"/>
     </classes> 
  </test> 
</suite>

combinesuite.xml :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="suite of suites"  parallel="classes" thread-count="2" >
    <suite-files>
        <suite-file path="testng1.xml" />
        <suite-file path="testng2.xml" />
    </suite-files>
</suite>


Kindly help me out to fix this issue.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to execute more than 1 xml file in PARALLEL with TestNG

⇜Krishnan Mahadevan⇝

Refer this blog post of mine : https://rationaleemotions.wordpress.com/2016/03/29/parallel-execution-of-multiple-testng-suites/

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Mohan Kumar <[hidden email]>
Reply-To: <[hidden email]>
Date: Monday, August 21, 2017 at 4:43 PM
To: testng-users <[hidden email]>
Subject: Re: [testng-users] How to execute more than 1 xml file in PARALLEL with TestNG

 

Hi All,

 

I am facing the same problem, when I have single test in two testng.xml(testng1.xml & testng2.xml) files means, browsers are launched simultaneously. 

 

But when I have more than one test in two testng.xml files means, testng2.xml file gets triggered only after testng1.xml file gets completed. 

 

Please check the below example.

 

testng1.xml

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

 

<suite name="Parallel suite 1" >

  <test name="Functional_Test_1">

   <parameter name="browser" value="Chrome" />

    <classes>    

      <class name="com.simpletest.sample1"/>

    </classes> 

  </test> 

 

   <test name="Functional_Test_2">

    <classes>    

       <class name="com.simpletest.sample2"/>

     </classes> 

  </test> 

</suite>

 

testng2.xml

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

 

<suite name="Parallel suite 2" >

  <test name="Functional_Test_3">

   <parameter name="browser" value="Chrome" />

    <classes>    

      <class name="com.simpletest.demo1"/>

    </classes> 

  </test> 

 

   <test name="Functional_Test_4">

     <classes>    

       <class name="com.simpletest.demo2"/>

     </classes> 

  </test> 

</suite>

 

combinesuite.xml :

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="suite of suites"  parallel="classes" thread-count="2" >

    <suite-files>

        <suite-file path="testng1.xml" />

        <suite-file path="testng2.xml" />

    </suite-files>

</suite>

 

 

Kindly help me out to fix this issue.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
12