This is definitely a bug and was accepted as such - or at least not
rejected. When I'm back from my vacation, I'll prioritize it along with a
number of others we have received. :-)
Charlie
On Tue, Jun 8, 2010 at 3:51 PM, Scott Hunter <email address hidden> wrote:
> Well, the documentation for TestFixtureSetUp indicates that:
>
> "TestFixtureSetUp methods may be either static or instance methods"
>
> and also:
>
> "The TestFixtureSetUp attribute is inherited from any base class.
> Therefore, if a base class has defined a SetFixtureSetUp method, that
> method will be called after each test method in the derived class."
>
> (although the last sentence I've quoted from the documentation has a
> typo, and seems to be copy/pasted incorrectly from the documentation for
> TearDown.)
>
> The problem comes in when both are combined, as in my example.
>
> If you go back to my original example, but change the
> TestBaseTestFixtureSetUp & TearDown methods to be non-static, you can
> see that they do get inherited by the derived test and executed, without
> any tests in the base, which is indeed what the documentation says is
> supposed to happen:
>
> TestBase TestFixtureSetUp
> TestDerived TestFixtureSetUp
> ***** TestDerived.TestMethod
> TestMethod
> TestDerived TestFixtureTearDown
> TestBase TestFixtureTearDown
>
>
> As additional context, in JUnit, @BeforeClass methods must always be
> static, and the equivalent code works as expected there:
>
> public class TestBase {
> @BeforeClass
> public static void testBaseBeforeClass() {
> System.out.println("TestBase");
> }
> }
>
> public class TestDerived extends TestBase {
> @BeforeClass
> public static void testDerivedBeforeClass() {
> System.out.println("TestDerived");
> }
>
> @Test
> public void testMethod() throws Exception {
> System.out.println("testMethod");
> }
> }
>
> Running testMethod() prints:
>
> TestBase
> TestDerived
> testMethod
>
> as expected.
>
> --
> static TestFixtureSetUp/TestFixtureTearDown methods in base classes are not
> run
> https://bugs.launchpad.net/bugs/590970
> You received this bug notification because you are a member of NUnit
> Developers, which is subscribed to NUnit V2.
>
Hi Scott,
This is definitely a bug and was accepted as such - or at least not
rejected. When I'm back from my vacation, I'll prioritize it along with a
number of others we have received. :-)
Charlie
On Tue, Jun 8, 2010 at 3:51 PM, Scott Hunter <email address hidden> wrote:
> Well, the documentation for TestFixtureSetUp indicates that: tureSetUp & TearDown methods to be non-static, you can TestMethod lass() { out.println( "TestBase" ); reClass( ) { out.println( "TestDerived" ); out.println( "testMethod" ); p/TestFixtureTe arDown methods in base classes are not /bugs.launchpad .net/bugs/ 590970
>
> "TestFixtureSetUp methods may be either static or instance methods"
>
> and also:
>
> "The TestFixtureSetUp attribute is inherited from any base class.
> Therefore, if a base class has defined a SetFixtureSetUp method, that
> method will be called after each test method in the derived class."
>
> (although the last sentence I've quoted from the documentation has a
> typo, and seems to be copy/pasted incorrectly from the documentation for
> TearDown.)
>
> The problem comes in when both are combined, as in my example.
>
> If you go back to my original example, but change the
> TestBaseTestFix
> see that they do get inherited by the derived test and executed, without
> any tests in the base, which is indeed what the documentation says is
> supposed to happen:
>
> TestBase TestFixtureSetUp
> TestDerived TestFixtureSetUp
> ***** TestDerived.
> TestMethod
> TestDerived TestFixtureTearDown
> TestBase TestFixtureTearDown
>
>
> As additional context, in JUnit, @BeforeClass methods must always be
> static, and the equivalent code works as expected there:
>
> public class TestBase {
> @BeforeClass
> public static void testBaseBeforeC
> System.
> }
> }
>
> public class TestDerived extends TestBase {
> @BeforeClass
> public static void testDerivedBefo
> System.
> }
>
> @Test
> public void testMethod() throws Exception {
> System.
> }
> }
>
> Running testMethod() prints:
>
> TestBase
> TestDerived
> testMethod
>
> as expected.
>
> --
> static TestFixtureSetU
> run
> https:/
> You received this bug notification because you are a member of NUnit
> Developers, which is subscribed to NUnit V2.
>