← Back to team overview

nunit-core team mailing list archive

[Bug 1047272] Re: TestContext.CurrentContext.Result throws NullReferenceException

 

After sending the last note, I looked at your comment again: "we can't
get the result in TearDown after exception in SetUpFixture." Before now,
unless I missed something, the reported problem was with
TestFixtureSetup and TestFixtureTearDown, not with SetUpFixture.

The current code works correctly for the test method itself and the
SetUp, TearDown, TestFixtureSetUp and TestFixtureTearDown for the
TestFixture. There's a good chance SetUpFixture will work as well
because the fix was made in a base class. However, without a test I
can't be sure, so I'll add one and reopen the bug if needed.

It's very difficult to discuss the different kinds of setup and teardown
without getting lost!

-- 
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/1047272

Title:
  TestContext.CurrentContext.Result throws NullReferenceException

Status in NUnit V2 Test Framework:
  Fix Committed

Bug description:
  We are using stable NUnit 2.6 for testing using C# .Net code mainly due to new /runlist command line option.
  Before each test in method with TestFixtureSetUp attribute we check if the test shouldn't be skipped. If so Assert.Ignore is called.
  Later in method with TestFixtureTearDown attribute we are used to check TestContext.CurrentContext.Result for actual test result and report it. In version 2.5.8 it worked correctly and Status in Result was properly set. Since 2.6.0 it throws NullReferenceException. Is it something planned and we should call Assert.Ignore or check for the Result somewhere else? Thanks

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunitv2/+bug/1047272/+subscriptions


References