I have an issue with TestNG's AfterMethod. I want to modify (fail) test result after method is executed.
TestNG version is "6.13.1" and I'm using any custom TestNG listeners.
@AfterMethod
public void checkTestStatus(ITestContext tc, ITestResult result) {
if (result.isSuccess()) {
tc.getPassedTests().removeResult(result.getMethod());
result.setStatus(ITestResult.FAILURE);
}
result.setThrowable(new Exception("Something happened!"));
tc.getFailedTests().addResult(result, result.getMethod());
Reporter.setCurrentTestResult(result);
}
Aucun commentaire:
Enregistrer un commentaire