title: Launch multiple Chrome Browser simultaneously using two testNG.XML Files
body: <p>I am planning to launch Chrome browsers simultaneously for two testng.xml files. Each testng.xml file has more than two tests.</p>
  
  <p>Then, I have combined two xml files in single suite file named as <strong>parentsuite.xml</strong> file.</p>
  
  <p>Two chrome browsers gets launched when testng1.xml and testng2.xml files have only test method each. But If the testng1.xml file has more than 1 test means, second chrome browser gets launched only after testng1.xml file execution gets completed.</p>
  
  <p>Please find the below example.</p>
  
  <p><strong>testng1.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"&gt;
  
  &lt;suite name="Parallel suite 1" &gt;
   &lt;test name="Browser Setup"&gt;
    &lt;parameter name="browser" value="Chrome" /&gt;
     &lt;classes&gt;    
      &lt;class name="com.simpletest.LaunchBrowser"/&gt;
     &lt;/classes&gt; 
   &lt;/test&gt; 
  
    &lt;test name="ApplicationSignin"&gt;
     &lt;paramater name = "username" value="xxxx"/&gt;
     &lt;parameter name="pwd" value="1111"/&gt;
     &lt;classes&gt;    
      &lt;class name="com.simpletest.Signin"/&gt;
     &lt;/classes&gt; 
    &lt;/test&gt; 
  &lt;/suite&gt;
  </code></pre>
  
  <p><strong>testng2.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"&gt;
  
  &lt;suite name="Parallel suite 2" &gt;
     &lt;test name="Browser Setup"&gt;
       &lt;parameter name="browser" value="Chrome" /&gt;
         &lt;classes&gt;    
          &lt;class name="com.simpletest.LaunchBrowser"/&gt;
         &lt;/classes&gt; 
     &lt;/test&gt; 
  
     &lt;test name="Application Signin"&gt;
      &lt;paramater name = "username" value="yyyy"/&gt;
      &lt;parameter name="pwd" value="2222"/&gt;
       &lt;classes&gt;    
        &lt;class name="com.simpletest.Signin"/&gt;
      &lt;/classes&gt; 
    &lt;/test&gt; 
  &lt;/suite&gt;
  </code></pre>
  
  <p><strong>Sample Code for Launching Browser</strong></p>
  
  <pre><code>public class LaunchBrowser
  {
    @Test
    @Parameters("browser")
    public void startBrowser(String browser)
    {
      switch(browser)
      {
       case "Chrome":
  
          desCapabilities = DesiredCapabilities.chrome();
          desCapabilities.setPlatform(Platform.ANY);
          desCapabilities.setBrowserName(DriverConstants.CHROME_BROWSER);
          System.setProperty("webdriver.chrome.driver", chromeDriverPath);
          driver = new ChromeDriver();
          driver.manage().window().maximize();
          System.out.println("For Browser : " + browser);
          break;
  
      case "Firefox":
          desCapabilities = DesiredCapabilities.firefox();
          desCapabilities.setPlatform(Platform.ANY);
          desCapabilities.setBrowserName(DriverConstants.FIREFOX_BROWSER);
          driver = new FirefoxDriver();
          driver.manage().window().maximize();
          System.out.println("For Browser : " + browser);
          break;
  
      default :
          System.out.println("Brower choice not available");     
  
      }
  }
  </code></pre>
  
  <p><strong>parentsuite.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" &gt;
  &lt;suite name="Selenium Test Suite" thread-count="2" preserve-order="true"&gt;
    &lt;suite-files&gt; 
      &lt;suite-file path="testng1.xml" /&gt;
      &lt;suite-file path="testng2.xml" /&gt;
    &lt;/suite-files&gt; 
  &lt;/suite&gt;
  </code></pre>
  
  <p><strong>Note:</strong> How to fix this issue without using Grid concept. Kindly help me to fix this issue.</p>