How to run the testcases parallel using tesNG. | Selenium Forum
M
Posted on 27/10/2016
How to run the test cases parallel using testing.I tried to run the below code in testing for parallel it is not running parallel.
--------------------------
TestNG.xml
-------------------------
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="My first suite" parallel="tests" thread-count="2">


<test name="ParellelTest TestNG">
<classes>
<class name="ParellelTestTestNG" ></class>
</classes>
</test>

<test name="ParellelTest TestNG1">
<classes>
<class name="ParellelTestTestNG2" ></class>
</classes>
</test>

</suite>
----------------------------------------------
ParellelTestTestNG.java
--------------------------------------------
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;

public class ParellelTestTestNG {

@Test
public void openbrowser(){
System.out.println("Opening the browser");
WebDriver driver=new FirefoxDriver();
driver.get("http://flipkart.com");
}


}
----------------------------------------------------------
ParellelTestTestNG2.java
--------------------------------------------------------

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.annotations.Test;

public class ParellelTestTestNG2 {


@Test
public void Openbrowser_withurl(){
System.setProperty("webdriver.ie.driver", "D:\\Selenium softwares\\IEDriverServer.exe");
WebDriver driver=new InternetExplorerDriver();
driver.get("http://google.com");
}

}

M
Replied on 28/10/2016

Try changing parallel="classes" in TestNG.xml


M
Replied on 01/11/2016

are you still having problem?