-
Notifications
You must be signed in to change notification settings - Fork 734
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
Test error in TestContextOneTimeTearDownTests. #4906
Comments
Each runner decides what to pay attention to in the output. Historically, the console ignored setup and teardown errors of all kinds and only reported on test cases. At some point (?) we decided to report assertion failures in setup and (I believe later) in teardown. Also, fwiw, at one time we decided that any assertion failure in a teardown was an error, rather than a failed test. That is, it was considered a mistake to have assertions in a teardown, although it wasn't something we could enforce. I'm not sure if that notion has been consistently maintained, however. |
Thanks for that historical context @CharliePoole Within the framework side, in response to @OsirisTerje 's point 1, I wonder if we should perhaps rewrite these tests a bit. We also have #937 as an older issue which aims to remove direct |
Interesting. It appears that the Perhaps then something has changed to prevent |
At our work we have a base class that in the Our base class asserts in the per test If any tasks are still running when NUnit thinks the test is finished, it won't be reported. NUnit itself, at the moment, doesn't see any exceptions raised in different threads. |
I'll check a few early versions tomorrow, but I am beginning to suspect that behavior may've changed prior to NUnit 3.0's launch. A likely solution would be to use |
I had a hard time understanding the intended |
Interestingly, moving the tests into the EDIT: I'll try and get some PR up soon, including something to validate that failed asserts in these lifecycle methods result in errors |
I'm back from vacation. One of the main reasons I haven't pushed a PR here yet is I would like to see if VS is passing in any filters here which could explain the difference in behavior. I'll be trying to investigate that soon |
This test have a set of Asserts in its OneTimeTearDown method.
These asserts show up as errors in Rider and Resharper, but in dotnet test, nor in Test Explorer in Visual Studio.
I have moved it into a separate repro test https://github.com/nunit/nunit.issues/tree/main/Issue4906
There are several issues here:
The test fails, so we have an error we have not detected.
This the essence of this Issue.
This test seems to have been written way back, in 2014/2015
The testfixture has one Explicit test, and checks that tthe Result.SkipCOunt is equalto 1. It is not.
(This pt should probably be transferred to the adapter) Rider/Resharper detects that this is a fault. It is not reported in VS/dotnet , it stops in the adapter. Enabling the dump I see it in the response from the engine/framework, but as it is test output, we have nowhere to put that output.
I know that MSTest adds a kind of extra test node in these cases. We could do the same. In NUnit all suites are also tests, and might have information. It would make sense to be able to show that. Rider does this too, so you see the node is failing.
In VS it is shown in the Output/Test window:
Further, NUnitLite does show it, but it is suppressed somewhere in out NUnit build output. I see it in the repro code I made.
Dump file output:
In the dump file we can also see that the skippedcount is 0, ref pt 1 here.
The repro is here: https://github.com/nunit/nunit.issues/tree/main/Issue4906
When running with VS the error is visible in the Output/Test as mentioned above.
When running with NUnitLite, it is not there, and debugging it, show SkippedCount = 1. Which is correct. I have no clue yet why it works when seperated out into this repro, and ONLY when running with NUnitLite.
@manfred-brands @stevenaw Comments ? @rprouse @CharliePoole You guys wrote this test 10 years ago. Does the console show this node? Is this pre-adapter ? Any idea why NUnitLite is confused ?
[UPDATE]
Just checked with the console:
It doesn't react to the test either.
But Rider does:
The text was updated successfully, but these errors were encountered: