Skip to content

Keep the failure status of retried TestNG attempts (fixes #452) - #1523

Open
Mohanad49 wants to merge 1 commit into
allure-framework:mainfrom
Mohanad49:fix/testng-retried-attempt-status
Open

Mohanad49 wants to merge 1 commit into
allure-framework:mainfrom
Mohanad49:fix/testng-retried-attempt-status

Conversation

@Mohanad49

@Mohanad49 Mohanad49 commented Nov 24, 2026 •

Copy link
Copy Markdown

Context

Fixes #452.

When a TestNG retry analyzer retries a test, TestNG ends the failed attempt with the SKIP status and wasRetried() set. onTestSkipped stopped every one of those attempts as SKIPPED, so the retries in the report said "skipped" and the real failure only showed up in the status details.

Now onTestSkipped checks result.wasRetried(), and a retried attempt gets the status of its throwable through the existing getStatus: FAILED for an AssertionError, BROKEN for anything else. Tests skipped for any other reason (failed dependencies, SkipException, data providers) are still SKIPPED.

I left the flaky flag alone. From the discussion in allure-framework/allure2#1135, flakiness comes from history in the report rather than from the adapter, so this only fixes the status of the attempts.

Tests:

  • shouldKeepFailedStatusOfRetriedAttempt runs a new sample that fails an assertion and passes on the retry. On main the two attempts come out as SKIPPED and PASSED; with this change they're FAILED and PASSED.
  • shouldKeepBrokenStatusOfRetriedAttempt runs the existing RetryTest sample, which always throws. On main that's SKIPPED and BROKEN; now it's BROKEN and BROKEN.

Everything ran through allure agent. The two new tests fail on main for exactly that reason, and the whole :allure-testng:test passes with the change (349 of 349). spotlessCheck, checkstyleMain, pmdMain and spotbugsMain pass for allure-testng.

#1519 adds a few lines right above the same stopTest call in onTestSkipped, so whichever one lands second needs a small rebase. Happy to do that on my side.

Checklist

…ework#452)

TestNG ends an attempt that its retry analyzer retries with the SKIP
status, and AllureTestNg reported it as skipped. The attempt actually
failed, so the result now carries the status of its throwable: failed
for an AssertionError, broken for anything else. Tests skipped for any
other reason are still reported as skipped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestNG retries are marked as Skipped and the test itself is not marked as Flaky Test

1 participant