docs icon indicating copy to clipboard operation
docs copied to clipboard

Error in doc: OneTimeTearDown is run even if OneTimeSetUp failed

Open debanne opened this issue 7 years ago • 5 comments

The page https://github.com/nunit/docs/wiki/OneTimeTearDown-Attribute contains the line:

So long as any OneTimeSetUp method runs without error, the OneTimeTearDown method is guaranteed to run. It will not run if a OneTimeSetUp method fails or throws an exception.

It should be removed because:

  • it is wrong (I tested with NUnit 3.7.1)
  • it contradicts the page https://github.com/nunit/docs/wiki/SetUp-and-TearDown-Changes that says:

Assume that an exception is thrown in BaseSetUp. In NUnit 2.6, methods would be executed as follows: BaseSetUp, DerivedTearDown, BaseTearDown In NUnit 3.0, execution will proceed as follows: BaseSetUp, BaseTearDown

debanne avatar Dec 14 '18 15:12 debanne

Correct, that doc page describes what happens inNUnitV2. However, somebody should check whether the changes outlined in the second quoted page were fully implemented. I can't remember.

CharliePoole avatar Dec 14 '18 15:12 CharliePoole

These pages still contradict each other

Rick-van-Dam avatar Feb 16 '21 08:02 Rick-van-Dam

I see my comment in 2018 may not have been understood.

The second citation describes how we want NUnit to work. Someone needs to ascertain if it works that way. If it is not working, then it's the code that needs fixing, not the comment. The first citation would tnen need correcting to match the correct behavior.

IOW, I don't think we should change the docs to match incorrect behavior in the framework.

Perhaps this should have been moved to be a framework issue rather than a documentation issue.

CharliePoole avatar Feb 16 '21 10:02 CharliePoole

After some simple tests it seems https://docs.nunit.org/articles/nunit/writing-tests/setup-teardown/SetUp-and-TearDown-Changes.html correctly describes the behavior of nunit.

Rick-van-Dam avatar Feb 16 '21 11:02 Rick-van-Dam

I put in a PR that simply deletes the incorrect line. If more detail is wanted, one of the @nunit/framework-team members should probably do that.

CharliePoole avatar Feb 16 '21 11:02 CharliePoole