Re: Addin SetUp question
"Charlie Poole" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nunit.devel |
|---|---|
| Message-ID | <006c01c87d67$59cc16b0$6401a8c0@ferrari> |
Hi Andreas, > On Sat, Mar 1, 2008 at 2:01 AM, Andreas Schlapsi > <[email protected]> wrote: > > Hi Kelly, > > > > there were some issues with SetUp and TestFixtureSetUp > methods in the > > RowTest Addin, but they are fixed in version 1.2.1. I had to add a > > RowTestSuite class which gets the actual fixture object > from its parent. > > In previous versions I had the problem that either SetUp > (in 1.2.0) > > or TestFixtureSetUp (in 1.1.0 and before) were called on another > > fixture instance than the test. > > > > In versions 1.2.0 and before the test structure looked like this: > > > > RowTestCase => TestSuite => NUnitTestFixture > > > > NUnitTestFixture created an instance of the test fixture > class and > > called TestFixtureSetUp/TestFixtureTearDown. > > But unfortunately TestSuite created its own instance of the test > > fixture class and SetUp/TearDown methods and the unit test were > > called on this instance. > > > > In version 1.2.0 I changed this and the RowTestCase got > its fixture > > instance not from its parent (TestSuite) but from its grandparent > > (NUnitTestFixture). Therefore the unit test was called on > the other > > instance. But RowTestCase is derived from NUnitTestMethod > which calls > > SetUp and TearDown. But NUnitTestMethod calls those method on the > > fixture instance from its parent which means that > SetUp/TearDown were > > not called on the instance the unit test ran on. > > > > In version 1.2.1 I changed the test structure to this: > > > > RowTestCase => RowTestSuite => NUnitTestFixture > > > > RowTestSuite gets the fixture instance from its parent before any > > method is run, so that all three classes uses the same > instance for > > all methods (TestFixtureSetUp, SetUp, unit test, TearDown, > TestFixtureTearDown). There is clearly a need for a class that represents all the test cases run using the same test method. The current NUnit hierarchy is Test <-- TestCase <-- TestMethod <-- NUnitTestMethod <-- TestSuite <-- TestFixture <-- NUnitTestFixture with only TestSuite's having child tests. I'm thinking of allowing all tests to have children and dropping TestCase from the hierarchy. A new TestCase class would be used as a child of a TestMethod and would represent the execution of the method with one set of arguments. Comments? Charlie ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/