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

Distinguish between failed and broken tests when using a 3rd party assertion library with Allure.NUnit and Allure.Xunit #520

Open
1 of 3 tasks
I37937 opened this issue Jun 10, 2024 · 6 comments
Labels
task:improvement Change that improves some user experience but can't be considered a new feature theme:nunit theme:xunit

Comments

@I37937
Copy link

I37937 commented Jun 10, 2024

I'm submitting a ...

  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

The test case failed using fluentassertions or Playwright are shown as broken instead of failed

If the current behavior is a bug, please provide the steps to reproduce and, if possible, a minimal demo of the problem

Create a simple test using FluentAssertions or Playwright dotnet, when you run the tests the resutl is shown as broken
image

What is the expected behavior?

The test should be failed if I have configured the list of exceptions (failExceptions).

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

Other information

I was taking a look to the AllureNUnitHelper and I was able to see that the IsBroken function is waiting elements in result.Assertions list but when you use FluentAssertions or Playwright this list is not update so the tests are always mark as broken.
image

@gamerka
Copy link

gamerka commented Jun 10, 2024

@I37937
Copy link
Author

I37937 commented Jun 10, 2024

Yes, I do, I have added the exceptions but I still having the same issue
image

@arman-avetisyan
Copy link

Hello, I have the same issue,
I am using Xunit, Allure.Net.Commons and Shouldly
When I run a test with this simple step, and generate an Allure report
the test status displayed as Broken
image

Also, I tried to add the Shouldly.ShouldAssertException to the allureConfig.json, the step becomes Failed but the test is still displayed as Broken
image

@flydyk
Copy link

flydyk commented Jun 10, 2024

Looks like this code is making a test report broken despite the settings
https://github.com/allure-framework/allure-csharp/blob/main/Allure.Xunit/AllureXunitHelper.cs#L39-L42

            var status = failure.ExceptionTypes.Any(
                exceptionType => !exceptionType.StartsWith("Xunit.Sdk.")
            ) ? Status.broken : Status.failed;

@S-Kulyk
Copy link

S-Kulyk commented Jul 16, 2024

The same issue with Nunit & FluentAssertions
It seems that the Nunit does not track the exception type. It has a stack trace in a message but doesn't hold an exception type directly. IMO, it would be convenient to detect Failed/Broken status by Nunit's ResultState.Failure/Error respectively

Also, I wonder if there is any workaround to have a "Failed" status instead of "Broken"?

@delatrie delatrie changed the title The test case failed using FluentAssertions or Playwright are shown as broken instead of failed Distinguish between failed and broken tests when using a 3rd party assertion library with Allure.NUnit and Allure.Xunit Jul 19, 2024
@delatrie delatrie added task:improvement Change that improves some user experience but can't be considered a new feature and removed bug labels Jul 19, 2024
@ohlori
Copy link

ohlori commented Oct 18, 2024

Any chance there's a timeline for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task:improvement Change that improves some user experience but can't be considered a new feature theme:nunit theme:xunit
Projects
None yet
Development

No branches or pull requests

7 participants