Skip to content

Report tests blocked by a broken @BeforeAll as separate results (fixes #1155) - #1390

Open
Yevhen-Bozhenko wants to merge 1 commit into
allure-framework:mainfrom
Yevhen-Bozhenko:fix/report-tests-blocked-by-broken-before-all
Open

Report tests blocked by a broken @BeforeAll as separate results (fixes #1155)#1390
Yevhen-Bozhenko wants to merge 1 commit into
allure-framework:mainfrom
Yevhen-Bozhenko:fix/report-tests-blocked-by-broken-before-all

Conversation

@Yevhen-Bozhenko

Copy link
Copy Markdown
Contributor

Context

Fixes #1155.

When @BeforeAll fails, the class is reported as one fake test result identified by the class.
A run where @BeforeAll succeeds reports one result per method instead, so the two never share a history id and a passing retry cannot replace the failure - the class stays red even after every test passes.

This reports the tests the failing container blocked, so both runs produce the same method-level history ids and the retry replaces them.

A blocked test is one with no result yet, which is not the same as one that never started - a @Disabled method never starts but already has a SKIPPED result. Every result goes through startTest, so that is where the unique id is recorded. A broken @AfterAll blocks nothing, and an aborted container is never retried, so both keep the fake test result.

Two existing tests change because they asserted the old class-level result: shouldProcessBrokenInBeforeAllTests, and shouldLinkFailedContainerFakeTestToItsScope, which is renamed to shouldLinkBlockedTestsToFailedContainerScope since there is no fake test in that scenario now.

One thing I would value your view on: blocked tests are linked to the failed container's scope only, not to their ancestor scopes via getParentScopeKeys, since they never started and have no scope of their own. Happy to change it if you would rather they were linked all the way up.

Checklist

When @BeforeAll fails, the class is reported as one fake test result carrying
the class id. A run where it succeeds reports one result per method instead,
so the two never share a history id and a passing retry cannot replace the
failure. The class stays red even after every test passes.

Report the blocked tests themselves, so both runs produce the same
method-level history ids and the retry replaces them. Only a test with no
result counts as blocked: a disabled test keeps its single skipped result,
and tests a nested class already reported are not reported again by its
parent. A broken @afterall blocks nothing, and an aborted container is never
retried, so both keep the fake test result.

fixes allure-framework#1155
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.

🐞: [JUnit 5] Incorrect suite status in Allure report when @BeforeAll fails on first run but passes on retry

1 participant