Skip to content

Soft Assertion Failures in [AfterScenario] not marking Scenario as Failed in CMD/Test Results #702

@Daniela-Fediuc

Description

@Daniela-Fediuc

Reqnroll Version

2.4.1

Which test runner are you using?

NUnit

Test Runner Version Number

2.4.1

.NET Implementation

.NET 8.0

Test Execution Method

Command line – PLEASE SPECIFY THE FULL COMMAND LINE

Content of reqnroll.json configuration file

No response

Issue Description

We are using Reqnnroll with NUnit and Selenium for our BDD test automation.
Our framework uses a custom SoftAssert class to collect multiple assertion failures during a scenario and throws an exception in the [AfterScenario] hook (teardown).
Problem:
• When a soft assertion failure occurs, the exception is thrown in [AfterScenario].
• The failure is correctly logged in our log files (e.g., logs.txt), and screenshots are taken.
• However, the test runner (CMD output) reports the scenario as "Passed" instead of "Failed".
• This leads to false positives: failed tests are not visible in the test results, only in logs.
Expected Behavior:
• If an exception is thrown in [AfterScenario], the scenario should be marked as failed in the test runner output (CMD, test explorer, CI pipeline, etc.), just as it is when an exception is thrown during a step.

Steps to Reproduce

  1. Use Reqnnroll with NUnit and Selenium.
  2. Implement a SoftAssert class that collects failures and throws in [AfterScenario].
  3. Run a scenario with a failing soft assertion.
  4. Observe that the failure is logged and screenshot is taken, but the scenario is reported as "Passed" in CMD/test results.

Link to Repro Project

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds infoNeeds more info from the reporter of the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions