请找到代码
Test(dataProvider = "User_login")
public void StatusForm_Verification(String uname, String pwd)
throws InterruptedException {
try {
NavigateToLogin();
Dashboard RD = LoginAs_user(uname, pwd);
Thread.sleep(2000);
if (Integer.parseInt(ReviewedStatuscount) >= 1) {
Assert.assertEquals("true",
revui.Btn_SaveReview.getAttribute("disabled"));
Assert.assertEquals("true",
revui.Btn_submitReview.getAttribute("disabled"));
Assert.assertEquals("true",
revui.Btn_Needmoreinfo.getAttribute("disabled"));
status = TestLinkAPIResults.PASSED;
} else {
throw new SkipException(
"Test Skipping - Reviewed count is Zero");
}
}catch((AssertionError ex) {
testlink_result = TestLinkAPIResults.TEST_FAILED;
msg = ex.getMessage();
}
}
在执行上述方法时,如果在 TestNG 报告中抛出任何断言错误,则它应该是 FAIL 状态 - 这是为了正确
但是如果我在上述方法中使用 Try catch 块(捕获 AssertionError),TestNG 报告始终是 PASS 状态,为什么?如何?