【发布时间】:2018-05-06 14:09:12
【问题描述】:
如何以编程方式永远运行所有测试用例?下面是我的设置......现在我必须无限运行这段代码......另一个要求是我需要在@aftersuite之后再次重新启动应用程序......我需要拆除测试用例,因为我需要在每个aftersuite之后生成报告......
例如:
public class SimpleTest extends TestBase
{
AppiumDriver driver;
@BeforeSuite
public void setUp() throws MalformedURLException {
// DesiredCapabilities and all setup
}
@Test(priority = 1)
public void testcase1()throws InterruptedException {
login();
}
@Test(priority = 2)
public void testcase2() throws InterruptedException {
//something
}
@Test(priority = 3)
public void testcase3() throws InterruptedException {
//something
}
@Test(priority = 4)
public void testcase4 throws InterruptedException {
//something
}
@Test(priority = 5)
public void testcase() throws InterruptedException{
//something
}
@Test(priority = 6)
public void testcase6() throws InterruptedException{
//something
}
@Test(priority = 7)
public void testcase_logout() throws InterruptedException {
logout();
}
@AfterSuite
public void testCaseTearDown()
{
driver.quit();
}
}
【问题讨论】:
-
...使用无限循环?
-
你能用代码给我建议吗?以上是我的设置配置。
-
无限循环调用testng类中的run()方法。请参阅文档中的示例 - testng.org/doc/…
标签: java selenium testing testng appium