@Override public IRetryAnalyzer getRetryAnalyzer() { return testNGMethod.getRetryAnalyzer(); }
@Override public IRetryAnalyzer getRetryAnalyzer() { return m_method.getRetryAnalyzer(); }
@Override public IRetryAnalyzer getRetryAnalyzer() { return m_method.getRetryAnalyzer(); }
@Override public IRetryAnalyzer getRetryAnalyzer(ITestResult result) { return m_method.getRetryAnalyzer(result); }
@Override public IRetryAnalyzer getRetryAnalyzer() { return testNGMethod.getRetryAnalyzer(); }
@Override public IRetryAnalyzer getRetryAnalyzer(ITestResult result) { return testNGMethod.getRetryAnalyzer(result); }
default IRetryAnalyzer getRetryAnalyzer(ITestResult result) { return getRetryAnalyzer(); }
default Class<? extends IRetryAnalyzer> getRetryAnalyzerClass() { return getRetryAnalyzer().getClass(); }
private void handleInvocationResults(ITestNGMethod testMethod, ITestResult testResult, FailureContext failure, StatusHolder holder, boolean wasResultUnaltered) { // // Go through all the results and create a TestResult for each of them // List<ITestResult> resultsToRetry = Lists.newArrayList(); Throwable ite = testResult.getThrowable(); int status = computeTestStatusComparingTestResultAndStatusHolder(testResult, holder, wasResultUnaltered); boolean handled = holder.handled; IRetryAnalyzer retryAnalyzer = testMethod.getRetryAnalyzer(); boolean willRetry = retryAnalyzer != null && status == ITestResult.FAILURE && failure.instances != null && retryAnalyzer.retry(testResult); if (willRetry) { resultsToRetry.add(testResult); Object instance = testResult.getInstance(); if (!failure.instances.contains(instance)) { failure.instances.add(instance); } testResult.setStatus(ITestResult.SKIP); } else { testResult.setStatus(status); if (status == ITestResult.FAILURE && !handled) { handleException(ite, testMethod, testResult, failure.count++); } } }
@Override public void afterInvocation(final IInvokedMethod method, final ITestResult testResult) { if (!method.isTestMethod()) { return; } if (testResult.getStatus() == ITestResult.FAILURE) { // Don't skip other tests with the current test method is flaky final boolean isFlakyTest = method.getTestMethod().getRetryAnalyzer() != null && method.getTestMethod().getRetryAnalyzer() instanceof FlakyRetryAnalyzer; if (!isFlakyTest) { synchronized (this) { logger.warn("!!! Test failure, all other tests will be skipped: {} !!!", testResult); hasFailures = true; } } } }
final boolean isFlakyTest = testNGMethod != null && testNGMethod.getRetryAnalyzer() != null && testNGMethod.getRetryAnalyzer() instanceof FlakyRetryAnalyzer; if (!isFlakyTest) { hasFailed = true;
computeTestStatusComparingTestResultAndStatusHolder(testResult, holder, wasResultUnaltered); boolean handled = holder.handled; IRetryAnalyzer retryAnalyzer = testMethod.getRetryAnalyzer(testResult);
@Override public void afterInvocation(final IInvokedMethod method, final ITestResult testResult) { if (testResult.getStatus() != ITestResult.FAILURE) { return; } final IRetryAnalyzer retryAnalyzer = testResult.getMethod().getRetryAnalyzer(); if (retryAnalyzer != null && retryAnalyzer instanceof FlakyRetryAnalyzer && !((FlakyRetryAnalyzer) retryAnalyzer).shouldRetry()) { // Don't fail the build (flaky test), mark it as SKIPPED testResult.setStatus(ITestResult.SKIP); Reporter.setCurrentTestResult(testResult); } } }
@Override public IRetryAnalyzer getRetryAnalyzer() { return delegate.getRetryAnalyzer(); }
@Override public IRetryAnalyzer getRetryAnalyzer() { return delegate.getRetryAnalyzer(); }
@Override public IRetryAnalyzer getRetryAnalyzer() { return method.getRetryAnalyzer(); }
@Override public synchronized void onTestFailure(ITestResult testResult) { if (testResult.getMethod().getRetryAnalyzer() != null) { TestRetryAnalyzer testRetryAnalyzer = (TestRetryAnalyzer) testResult.getMethod().getRetryAnalyzer(); // test will be retried if (testRetryAnalyzer.retryPeek(testResult)) { testResult.setStatus(ITestResult.SKIP); Reporter.setCurrentTestResult(null); } logger.info(testResult.getMethod() + " Failed in " + testRetryAnalyzer.getCount() + " times"); } }
@Override public void onTestFailure(ITestResult result) { IRetryAnalyzer analyzer = result.getMethod().getRetryAnalyzer(); if (analyzer != null && analyzer instanceof Retry) { result.setStatus(((Retry) analyzer).isRetryAvailable()? ITestResult.SKIP : ITestResult.FAILURE); Reporter.setCurrentTestResult(result); } }
@Override public void onTestFailure(ITestResult result) { IRetryAnalyzer analyzer = result.getMethod().getRetryAnalyzer(); if (analyzer != null && analyzer instanceof Retry) { result.setStatus(((Retry) analyzer).isRetryAvailable()? ITestResult.SKIP : ITestResult.FAILURE); Reporter.setCurrentTestResult(result); } }
@Override public void afterInvocation(final IInvokedMethod method, final ITestResult testResult) { if (!method.isTestMethod()) { return; } if (testResult.getStatus() == ITestResult.FAILURE) { // Don't skip other tests with the current test method is flaky final boolean isFlakyTest = method.getTestMethod().getRetryAnalyzer() != null && method.getTestMethod().getRetryAnalyzer() instanceof FlakyRetryAnalyzer; if (!isFlakyTest) { synchronized (this) { logger.warn("!!! Test failure, all other tests will be skipped: {} !!!", testResult); hasFailures = true; } } } }