Skip to content

fix: prevent exceptions to be rethrown during the cleanup methods of data-driven tests - #3750

Open
zelite wants to merge 1 commit into
serenity-bdd:mainfrom
zelite:fix/teardown-datadriven-screenplay
Open

fix: prevent exceptions to be rethrown during the cleanup methods of data-driven tests#3750
zelite wants to merge 1 commit into
serenity-bdd:mainfrom
zelite:fix/teardown-datadriven-screenplay

Conversation

@zelite

@zelite zelite commented Aug 24, 2026

Copy link
Copy Markdown

Summary of this PR

Fixes exception handling in data-driven screenplay tests when teardown methods are called. The fix prevents nested exceptions from being thrown when cleanup steps are executed.

Intended effect

Previously: when a datadriven test, executed via SerenityReporter, fails due to an exception, the exception would be rethrown during the teardown method of a screenplay actor, preventing the teardown to run to completion.

With the fix: the teardown method does not rethrow the exception thrown during the test.

How should this be manually tested?

  1. Build the branch locally
  2. Clone the project in: https://github.com/zelite/serenity-teardown-reproduce and change the serenity.version in the pom to the build snaphot ( <serenity.version>5.3.12-SNAPSHOT</serenity.version> )
  3. Run both classes CucumberTestSuiteNonParallel and CucumberTestSuiteParallel.
  4. Verify that for both test suites, the string "Reached end of teardown" is printed.

Side effects

None identified.

Relevant tickets

#3747

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.

1 participant