【发布时间】:2019-08-16 08:10:02
【问题描述】:
-
krGlobalPage.softAssertionTestCall2(softAssertion);必须在krGlobalPage.softAssertionTestCall1(softAssertion);失败后运行,因为
【问题讨论】:
标签: java selenium testng allure
krGlobalPage.softAssertionTestCall2(softAssertion); 必须在 krGlobalPage.softAssertionTestCall1(softAssertion); 失败后运行,因为【问题讨论】:
标签: java selenium testng allure
我发现最好的方法 - 并且在 Allure 报告中显示为失败 - 是尝试捕获 findelement 并在 catch 块中,将 assertTrue 设置为 false,如下所示:
try {
driver.findElement(By.xpath("(//nav[@class='topline']//nav[@class='without-seperator1']/a)[1]");
}catch(Exception e) {
assertTrue(false, "Test Search link was not displayed");
}
【讨论】: