← 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: New => Triaged

** Changed in: nunit-3.0
    Milestone: None => 2.9.4

** Also affects: nunitv2
   Importance: Undecided
       Status: New

** Changed in: nunitv2
       Status: New => Triaged

** Changed in: nunitv2
   Importance: Undecided => Medium

** Changed in: nunitv2
    Milestone: None => 2.5.5

-- 
 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: Triaged
Status in NUnit V2 Test Framework: Triaged

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