Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing JUnit5 assumptions outside of stage are handled as successful test case #1856

Open
abika opened this issue Feb 11, 2025 · 2 comments
Assignees

Comments

@abika
Copy link

abika commented Feb 11, 2025

Hi,

the changes done by #1625 seem to have an unwanted effect: If a JUnit5 assumption outside of a given()/when()/then() stage is failing, this results in a scenario case with "status": "SUCCESS" in the JSON report and no indication of a skipped test or exception is visible.
Therefore in the HTML report the test scenario is shown as successful and the steps are not completely visible (because the test run stops at the assumption exception).

I would expect that in this case the test result would be "ABORTED" as well (and errorMessage and stackTrace should be recorded).

@l-1squared
Copy link
Collaborator

Hi, sorry for reacting rather late, missed you in my email feed.

Could you clarify a bit what you mean to make analysis eaiser for me?
So did you place the assumption in a scenario / Junit5 before method or elsewhere?

@abika
Copy link
Author

abika commented Feb 21, 2025

Hi, the wrong behavior can (only) be observed if a JUnit5 assumption is failing directly in the test method :

  @Test
  void assumption_test() {
    Assumptions.abort();

    given().some_state();
    when().some_action();
    then().some_outcome();
  }

This is results in a JSON file containing "status": "SUCCESS" and containing no errorMessage and stackTrace fields, and no steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants