From: David N. <da...@de...> - 2003-09-06 01:18:00
|
Hello,=0D =0D I have a couple of questions about TTestSetup=0D =0D I understand its setup and teardown are run once before the decorated tes= ts are run.=0D =0D However, what if I have to have the decorated tests have access to some variables that the tTestSetup has=0D =0D i.e.=0D =0D TSetup=3Dclass(TTestSetup)=0D private=0D fSomeObject:tObject;=0D protected=0D procedure setup;override;=0D procedure teardown;override;=0D end;=0D =0D TSetup creates and destroys some object which it stores in fSomeObject=0D =0D then I have some TestCase=0D TmyTests=3Dclass(tTestCase)=0D published=0D procedure testfirst;=0D end;=0D =0D My initialization section currently looks like this=0D initialization=0D TestFramework.RegisterTest(unitTests);=0D =0D =0D function UnitTests:ITestSuite;=0D var=0D myTestSuite:tTestSuite;=0D begin=0D myTestSuite:=3DtTestSuite.create('some bullshit');=0D myTestSuite.addTest(TTestCaseBasic.suite);=0D =0D result:=3DmyTestSuite;=0D end;=0D =0D so I guess my first question is how would I decorate the myTests with the TSetup=0D my second question is how can I get the tests in TMyTests to have access= to the variable in TSetup=0D =0D any help is appreciated. This stuff is kind of confusing. |