[英]Running one testcase in parallel in remote machine and local machine using @Test annotation
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 -->
当我将Test.xml文件作为TestNG运行时,两个脚本都仅在远程计算机上运行(192.167.78.89)...我将如何在本地计算机和远程计算机上并行运行脚本。
有人可以帮我解决这个问题吗?
谢谢,
苏丹苏
您的一项测试应指向本地浏览器。 如果我们更改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();
}
这样行吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.