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

Show exception details and stacktrace if TestFixtureSetUp blows up #99

Open
hickford opened this issue Feb 22, 2016 · 4 comments
Open

Comments

@hickford
Copy link

Reproduced from https://stackoverflow.com/questions/1411676/how-to-diagnose-testfixturesetup-failed

NUnit should show exception details and stacktrace if TestFixtureSetUp blows up, as it does when a test fails.

Test Name:  ExampleTest
Test FullName:  ExampleTests.ExampleTest
Test Source:    ExampleTests.cs : line 56
Test Outcome:   Failed
Test Duration:  0:00:00.0000001

Result Message: TestFixtureSetUp failed in ExampleTests

@CharliePoole
Copy link
Contributor

The NUnit VS Adapter is... well, an adapter! It can only adapt NUnit to the interfaces and displays provided by the Visual Studio Test Window. That window is exclusively devoted to listing individual test cases, so it's difficult to report any other kind of error.

If you run tests under the NUnit Console runner, TestFixtureSetUp failures are listed individually. Similarly, if you use the Gui, the properties of the node representing the fixture will show the exact result and the Errors and Failures tab will also list it.

There are two ways I can imagine handling this request...

  1. Display the information as a sort of log entry in the Output window at the bottom of the screen. This is already cluttered with warnings of various kinds but it may still be desirable. If the individual test indicated a setup failure, you might have to look here.
  2. Create an error message from the setup failure and use it for every test in that fixture. That way, the error would be seen no matter which method you selected. Ironically, this is what NUnit used to do. We stopped doing it because the console output became crowded with repeated failures whenever a TestFixtureSetUp threw an exception. Since NUnit no longer reports the info in this way, I would have to look at the code to see how feasible it is to do it within the adapter.

@CharliePoole
Copy link
Contributor

No comments for eight months!!! I'll give it another month before closing. How do folks think this situation should be handled?

@OsirisTerje
Copy link
Member

I've been looking at doing it as your option 1 above in the NUnIt3 adapter and the same can be done here.

@unickq
Copy link

unickq commented Jul 18, 2018

I think it might help - to store TestFixtureSetUp/TestFixtureTearDown exceptions/statuses somewhere

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

No branches or pull requests

4 participants