Skip to content

3.6 Multiple assertion backwards compatibility #2007

Closed
@AndyBan

Description

@AndyBan

We use nunit along with selenium to check that elements are present on a web page etc. Our framework uses exception capturing loops for certain cases such as interacting with browsers which isn't always the most reliable thing. This allows a bit of time for elements to appear which they are created by Javascript however if things don't appear after a short time then the nunit assertion exception is not captured and bubbles up to the runner and is reported on.

We have found since upgrading to 3.6 that the failed assertions are getting recorded due to the new multiple assertion feature even though the same assertion later passes. I think exceptions should not be recorded unless you are inside a multiple assertion block, would you agree?

A potential fix is to move this earlier in the ReportFailure method:
if (TestExecutionContext.CurrentContext.MultipleAssertLevel == 0)
throw new AssertionException(writer.ToString());

in src/NUnitFramework/framework/Assert.cs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions