use of org.killbill.billing.api.FlakyRetryAnalyzer in project killbill by killbill.
the class GuicyKillbillTestSuite method afterMethodAlwaysRun.
@AfterMethod(alwaysRun = true)
public void afterMethodAlwaysRun(final Method method, final ITestResult result) throws Exception {
if (hasFailed()) {
return;
}
final String tag;
switch(result.getStatus()) {
case SUCCESS:
tag = "SUCCESS";
break;
case FAILURE:
tag = "!!! FAILURE !!!";
break;
case SKIP:
tag = "SKIP";
break;
case SUCCESS_PERCENTAGE_FAILURE:
tag = "SUCCESS WITHIN PERCENTAGE";
break;
case STARTED:
tag = "STARTED";
break;
case CREATED:
tag = "CREATED";
break;
default:
tag = "UNKNOWN";
break;
}
log.info("***************************************************************************************************");
log.info("*** Ending test {}:{} {} ({} s.)", new Object[] { method.getDeclaringClass().getName(), method.getName(), tag, (result.getEndMillis() - result.getStartMillis()) / 1000 });
log.info("***************************************************************************************************");
if (!hasFailed && !result.isSuccess()) {
// Ignore if the current test method is flaky
final ITestNGMethod testNGMethod = result.getMethod();
final boolean isFlakyTest = testNGMethod != null && testNGMethod.getRetryAnalyzer(result) != null && testNGMethod.getRetryAnalyzer(result) instanceof FlakyRetryAnalyzer;
if (!isFlakyTest) {
hasFailed = true;
}
}
}
Aggregations