-
Notifications
You must be signed in to change notification settings - Fork 742
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
TimeoutAttribute makes all Assertions count as failure #3282
Labels
Milestone
Comments
mikeharder
added a commit
to mikeharder/azure-sdk-for-net
that referenced
this issue
Dec 13, 2019
- Workaround for NUnit bug "TimeoutAttribute makes Assert.Inconclusive() count as failure" (nunit/nunit#3282)
mikeharder
added a commit
to Azure/azure-sdk-for-net
that referenced
this issue
Dec 13, 2019
- Add LiveOnly attribute to Assert.Inconclusive() tests - Workaround for NUnit bug "TimeoutAttribute makes Assert.Inconclusive() count as failure" (nunit/nunit#3282)
Another option:
|
Came here to report this exact issue. We want to use an assembly-wide |
Ran into this too. |
This was referenced Sep 21, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello
TimeoutAttribute(via TimeoutCommand) wraps the tests in a Task.Wait call under netcore (because Thread.Abort is no longer supported API), here:
nunit/src/NUnitFramework/framework/Internal/Commands/TimeoutCommand.cs
Line 102 in d8490ec
Using any of the 'flow-control' assertions like Assert.Ignore will throw their respective special-case Exception (here IgnoreException), which Task.Wait will wrap in an AggregateException, which is not handled by ValidateAndUnwrap here
nunit/src/NUnitFramework/framework/Internal/Results/TestResult.cs
Line 564 in c3caee3
This will result in the test counting as full-blown failure due to unhandled exception.
This simple test will do it:
I believe it should be safe to change ValidateAndUnwrap to handle AggregateExceptions the same way it does for TargetInvocationExceptions. It may also be beneficial to dive into the exception recursively instead of only once.
The text was updated successfully, but these errors were encountered: