Hi Everyone,
I want to run one testcase in two different machines parallel with different combinations of OS and Browser. But when iam running it is running in remote machine only but parallel..How to run in two machines in parallel?
I am using the below code to make it happen.
Running in Chrome browser in Remote machine in 5556 port
@Test
public void inChrome() throws MalformedURLException {
DesiredCapabilities capability = DesiredCapabilities.chrome();
// Setting the browser
capability.setBrowserName(BrowserType.CHROME);
// Setting the platform
capability.setPlatform(Platform.WINDOWS);
// Running in the remote machine.
WebDriver driver = new RemoteWebDriver(new URL(
"http://192.167.78.89:5556/wd/hub"), capability);
driver.get("https://www.google.co.in/");
driver.close();
}
// Running in firefox browser in local machine where hub is running
@Test
public void inFirefox() throws MalformedURLException {
DesiredCapabilities capability = DesiredCapabilities.firefox();
// Setting the browser
capability.setBrowserName(BrowserType.FIREFOX);
// Setting the platform
capability.setPlatform(Platform.WINDOWS);
// Running in the local machine.
WebDriver driver = new RemoteWebDriver(new URL(
"http:// :4444/wd/hub"), capability);
driver.get("https://www.google.co.in/");
driver.close();
}
and i have testing.xml file
<?xml version="1.0" encoding="UTF-8"?>
<suite name="classname" verbose="3">
<test name="Test" parallel="methods" thread-count="3">
<classes>
<class name="packagename.classname"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
When i am running the testing.xml file as TestNG both of the scripts are running on the remote machine(192.167.78.89) only...How i will run the script in local machine and remote machine parallel.
Can someone help me out how to make it possible?
Thanks,
Sudhansu
One of your test should point local browser. If we change inFirefox() to do that, it will be like the following:
@Test
public void inFirefox() throws MalformedURLException {
// Running in the local machine.
WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.co.in/");
driver.close();
}
Will this work?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.