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 -->
当我运行tests.xml文件作为TestNG时,两个脚本仅在远程计算机上运行(192.167.78.89)...我将如何在本地计算机和远程计算机并行运行脚本。
有人可以帮我解决这个问题吗?
谢谢,
Sudhansu
答案 0 :(得分:0)
您的一个测试应该指向本地浏览器。如果我们改变inFirefox()来做到这一点,它将如下所示:
@Test
public void inFirefox() throws MalformedURLException {
// Running in the local machine.
WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.co.in/");
driver.close();
}
这会有用吗?