Parallel Execution of test In multiple browsers using testNG

rencontrer l'autre dans son modèle du monde Selenium WebDriver does not have any feature which will allow us to perform parallel execution in multiple browsers. So with the help of TestNG we can perform parallel execution in selenium. 

This can be done by using visit the website @parameters annotation.

Let’s consider the below example:

package Testng_Pack;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

public class Test_Parallel {

   private  WebDriver driver=null;
  //parameter value will retrieved from testng.xml file's <parameter> tag.
   @Parameters ({"browser"})
   public void setupBrowser(String browser){//Method will pass value of parameter.
     if (browser.equals("FFX")) {//If value Is FFX then webdriver will open Firefox Browser.
     System.out.println("Test Starts Running In Firefox Browser.");
     driver = new FirefoxDriver();   
      else if (browser.equals("CRM")){//If value Is CRM then webdriver will open chrome Browser.
     System.out.println("Test Starts Running In Google chrome.");
     System.setProperty("", "C:\\Users\\sujyonta.giri\\Downloads\\chromedriver.exe");
     driver = new ChromeDriver();   
      else if (browser.equals("IE")){//If value Is ie then webdriver will open IE Browser.
       System.out.println("Test Starts Running In IE.");
       System.setProperty("", "C:\\Users\\sujyonta.giri\\Downloads\\IEDriverServer.exe");
       driver = new InternetExplorerDriver();   
   //Both bellow given tests will be executed In all the browsers.
   public void verify_title(){   
     String title = driver.getTitle();
     Assert.assertEquals("Welcome: Mercury Tours", title);
     System.out.println("Title Is Fine.");   
   public void verify_message(){  
   public void closebrowser(){

In the above code, we have site de rencontre Г®le de la rГ©union setupBrowser method with @Parameters annotation along with parameter site de rencontre pour maghrebin de francebrowser. In the xml we will define three tests tags to run each test with different browser. We will compare the browser value with the parameter value and based on that we will create the driver instance. We have now defined three tests with three browsers (Firefox, Google Chrome and Internet Explorer). como conocer chicas x whatsapp Testng.xml

<!DOCTYPE suite SYSTEM "" >
<suite name="webDriver" parallel="tests">
   <test name="Test In FireFox" >
    <parameter name="browser" value="FFX" />
      <class name="Testng_Pack.Test_Parallel" />
   <test name="Test In Google Chrome" >
    <parameter name="browser" value="CRM"></parameter>
      <class name="Testng_Pack.Test_Parallel"></class>
  <test name="Test In IE" >
    <parameter name="browser" value="IE"></parameter>
      <class name="Testng_Pack.Test_Parallel"></class>

In the above testng.xml we have defined parallel=”tests” in suite tag. So all the browsers will run in parallel.

If you want to run the browsers one after another then simply remove parallel=”tests” from testng.xml file.