【发布时间】:2019-04-20 15:14:14
【问题描述】:
我正在建立一个框架并希望在多个浏览器实例中并行运行一个测试方法(点击 url 然后执行一些操作) (例如:通过同时打开约 5 个 chrome 浏览器实例来访问 url)
我之前可以并行运行不同的测试方法,但我想一次运行多个测试用例(并行)
GoogleTest.java
@Test(invocationCount=2)
public void hitUrl() throws Exception {
WebDriver driver = getDriver();
driver.get("https://google.com");
}
TestNG.xml
<suite thread-count="2" verbose="2" name="Gmail Suite"
annotations="JDK" parallel="methods">
<test name="Google_Test">
<classes>
<class name="big.GoogleTest">
<methods>
<include name="hitUrl" />
</methods>
</class>
</classes>
</test>
我希望一次打开两个 chrome 浏览器实例,但它们一个接一个地在单个浏览器实例中运行。
【问题讨论】:
标签: java multithreading selenium selenium-webdriver testng