← Back to team overview

nunit-core team mailing list archive

[Bug 590970]

 

http://kinkelder-duiven.nl/AWStats/news.html?w3v5j0

-- 
You received this bug notification because you are a member of NUnit
Core Developers, which is the registrant for NUnit Framework.
https://bugs.launchpad.net/bugs/590970

Title:
  static TestFixtureSetUp/TestFixtureTearDown methods in base classes
  are not run

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

Bug description:
  NUnit 2.5.5.  Even though TestFixtureSetUp/TestFixtureTearDown methods
  can be static, if they are defined them in a base class, they won't be
  executed.  From looking at the code, it seems like the problem is that
  the reflection code to find fixture setup/teardown methods does not
  search base classes.

  To reproduce:

  using System;
  using NUnit.Framework;

  public class TestBase
  {
  	[TestFixtureSetUp]
  	public static void TestBaseTestFixtureSetUp()
  	{
  		Console.Out.WriteLine("TestBase TestFixtureSetUp");
  	}
  	
  	[TestFixtureTearDown]
  	public static void TestBaseTestFixtureTearDown()
  	{
  		Console.Out.WriteLine("TestBase TestFixtureTearDown");
  	}
  }

  public class TestDerived : TestBase
  {
  	[TestFixtureSetUp]
  	public static void TestFixtureSetUp()
  	{
  		Console.Out.WriteLine("TestDerived TestFixtureSetUp");
  	}
  	
  	[TestFixtureTearDown]
  	public static void TestFixtureTearDown()
  	{
  		Console.Out.WriteLine("TestDerived TestFixtureTearDown");
  	}
  	
  	[Test]
  	public void TestMethod()
  	{
  		Console.Out.WriteLine("TestMethod");
  	}
  }

  When you run this test, it only prints messages for the TestDerived
  class, not for TestBase.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunit-3.0/+bug/590970/+subscriptions


References