Hi,
I want to do cross browser(chrome and Firefox) parallel execution in two different machines using Selenium Grid, TestNG,Selenium Webdriver. As my code is not supporting multithreading ,One of the excfution is stopped and another execution is successfully completed. Please suggest What I should do for parallel test excution.
My Java Code:
@Parameters("browser")
@BeforeTest
public void SetupBrowser(String browser) throws MalformedURLException
{
DesiredCapabilities capability=null;
String baseurl="
http://10.195.7.71:8080/application/";
String nodeurl="
http://10.195.11.167:5566/wd/hub";
if (browser.equalsIgnoreCase("chrome"))
{
System.setProperty("webdriver.chrome.driver", "\\10.195.11.167\\c$\\Program Files (x86)\\Google\\Chrome\\Applicationchromedriver.exe");
capability = DesiredCapabilities.chrome();
capability.setBrowserName("chrome");
capability.setPlatform(Platform.VISTA);
}
if(browser.equalsIgnoreCase("firefox"))
{
capability = DesiredCapabilities.firefox();
capability.setBrowserName("firefox");
capability.setPlatform(Platform.VISTA);
}
driver=new RemoteWebDriver(new URL(nodeurl),capability);
driver.get("
http://10.195.7.71:8080/application/");
TestNG XML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "
http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="tests" thread-count="2" >
<test name="Chrome" >
<parameter name="browser" value="chrome"></parameter>
<classes>
<class name="com.lexmark.testclass.TestARR"/>
</classes>
</test>
<test name="FireFox" >
<parameter name="browser" value="firefox"></parameter>
<classes>
<class name="com.lexmark.testclass.TestARR"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->