← Back to team overview

nunit-core team mailing list archive

[Bug 523335] Re: TestFixtureTearDown in static class not executed

 

** Changed in: nunit-3.0
       Status: Triaged => Fix Committed

-- 
 TestFixtureTearDown in static class not executed
https://bugs.launchpad.net/bugs/523335
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.

Status in NUnit Test Framework: Fix Committed
Status in NUnit V2 Test Framework: Fix Committed

Bug description:
Here's an example:

    [TestFixture]
    public static partial class Tests
    {
        [TestFixtureSetUp]
        public static void Init()
        {
            Console.WriteLine("INIT");
        }

        [TestFixtureTearDown]
        public static void Cleanup()
        {
            Console.WriteLine("CLEANUP");
        }
    }

Init() gets executed but Cleanup() does not.

Could it be that this code, in NUnitCore\core\TestSuite.cs:

        protected virtual void DoOneTimeTearDown(TestResult suiteResult)
        {
            if ( this.Fixture != null)

should actually look like this:

        protected virtual void DoOneTimeTearDown(TestResult suiteResult)
        {
            if ( this.FixtureType != null)

which would make it the same as DoOneTimeSetUp?





References