Re: Addin SetUp question
"Kelly Anderson" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nunit.devel |
|---|---|
| Message-ID | <[email protected]> |
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). > > > > > Kelly Anderson schrieb: > Andreas, In RowTestSuite, you override these two functions, but they don't do anything... protected override void DoOneTimeSetUp(TestResult suiteResult) { } protected override void DoOneTimeTearDown(TestResult suiteResult) { } How does that work? Shouldn't it call something? -Kelly ------------------------------------------------------------------------- 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/