Skip to content

Treat an exception as an assertion failure and always add it to the assertion list. - #4979

Merged
manfred-brands merged 3 commits into
mainfrom
Issue4537_ExceptionsAreAssertionFailures
Apr 25, 2025
Merged

Treat an exception as an assertion failure and always add it to the assertion list.#4979
manfred-brands merged 3 commits into
mainfrom
Issue4537_ExceptionsAreAssertionFailures

Conversation

@manfred-brands

Copy link
Copy Markdown
Member

Fixes #4537

There is a change in RepeatAttribute behaviour:

  1. If an exception is thrown and StopOnFailure is false, the test continues executing.
  2. Test result are reset between runs. So if the last run passes, the test succeeds. Previously it would fail.

The above are side effects of #4861 and only affect the code when StopOnFailure is set to false.

@OsirisTerje OsirisTerje left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just commented on some smaller coding stuff.
The change seems to hit rather large, but seems to be well covered by the tests.

Comment thread src/NUnitFramework/framework/Attributes/RepeatAttribute.cs
Comment thread src/NUnitFramework/framework/Interfaces/AssertionResult.cs Outdated
Comment thread src/NUnitFramework/framework/Internal/Results/TestResult.cs Outdated
Comment thread src/NUnitFramework/framework/Internal/Results/TestResult.cs Outdated
Comment thread src/NUnitFramework/framework/Internal/Results/TestResult.cs Outdated
Comment thread src/NUnitFramework/framework/Internal/Results/TestResult.cs Outdated
@manfred-brands
manfred-brands force-pushed the Issue4537_ExceptionsAreAssertionFailures branch from 7eb206f to 7e75b20 Compare April 25, 2025 02:12
@manfred-brands
manfred-brands merged commit fd1ed68 into main Apr 25, 2025
@manfred-brands
manfred-brands deleted the Issue4537_ExceptionsAreAssertionFailures branch April 25, 2025 02:31
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.

AssertException in TearDown hides Exception in Test

2 participants