Re: Latest NUnit not running superclasssetup/teardown in 2.4.7?
"Charlie Poole" <[email protected]> Thu, 3 Jul 2008 14:04:27 -0700
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <004401c8dd50$62e0f010$6401a8c0@ferrari> |
What will or won't work depends on a few things: 1) Where there are methods with attributes 2) Whether any of those methods are redefined in derived classes. Note that by design NUnit will /never/ run more than one of each type of setup/teardown method, no matter how many times you repeat the attribute. However, I'm not clear that the OP is trying to do the same thing as you. BTW, I'm thinking of allowing multiple SetUp/TearDown methods in 2.5. Charlie > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf > Of Ron Grabowski > Sent: Thursday, July 03, 2008 1:27 PM > To: [email protected] > Subject: Re: [Nunit-users] Latest NUnit not running > superclasssetup/teardown in 2.4.7? > > I've been using this pattern for several version of NUnit. I > could never get it work your way: > > class BaseClass { > [TestSetUp] > public void TestSetUp() { > // set-up code > PostTestSetUp(); > } > > protected virtual void PostTestSetUp() { > // empty > } > } > > class BaseSubClass : BaseClass { > } > > [TestFixture] > class MyTestCase : BaseSubClass { > override protected void PostTestSetUp() { > // additional TestSetUp code goes here... > } > } > > ----- Original Message ---- > From: Doug Mayer <[email protected]> > To: [email protected] > Sent: Thursday, July 3, 2008 3:55:30 PM > Subject: [Nunit-users] Latest NUnit not running superclass > setup/teardown in 2.4.7? > > I'm having trouble getting something like this to work with > NUnit 2.4.7, but it works fine in 2.4.6: > > class BaseClass { > // fixture and test set-up and tear-down } > > class BaseSubClass : BaseClass { > } > > [TestFixture] > class MyTestCase : BaseSubClass { > } > > > The tests in MyTestCase won't do any of the setup/teardown > (both fixture and per-test) defined in the BaseClass. Is > this a bug or an intended breaking change? Has anyone else seen this? > > Thanks! > Doug > > -------------------------------------------------------------- > ----------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source > project, along with a healthy diet, reduces your potential > for chronic lameness and boredom. Vote Now at > http://www.sourceforge.net/community/cca08 > _______________________________________________ > Nunit-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/nunit-users > > > -------------------------------------------------------------- > ----------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source > project, along with a healthy diet, reduces your potential > for chronic lameness and boredom. Vote Now at > http://www.sourceforge.net/community/cca08 > _______________________________________________ > Nunit-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/nunit-users > ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08