由于测试应用程序中出现了一个空白页面,我在Getter方法中看到了一个NoSuchElement异常。在上述测试失败后,如何确保测试继续进行到下一个级别。
TestCode:
test.pageClick(logger);
test.PageHeaderValidation(logger);
test.editpageClick(logger);
***test.editPageHeaderValidation(logger);*** (this page is appearing blank so Header element is not found - hence NoSuchelement exception in the getter method );
test.switchoutfromIfrane(logger);如何确保测试继续进行下一个方法,而不是停止在失败的方法。
新的门户,如果这不是正确的空间,道歉。
发布于 2022-05-17 11:11:58
也许是这样的:
try {
test.editPageHeaderValidation(logger);
} catch (NoSuchElementException e) {
// Maybe turn some variable to true to show that the exception was caught?
// Like: boolean emptyPageHeaderThrows = true;
}或者如果您使用的是JUnit:
import static org.junit.jupiter.api.Assertions.assertThrows;
assertThrows(NoSuchElementException.class, () - > test.editPageHeaderValidation(logger))https://stackoverflow.com/questions/72268747
复制相似问题