Re: SetUp and tearDown once for one junit class
Wednesday, December 7, 2005 08:20 AM
U can write a BaseTestCase class extends TestCase having only the setUp() and tearDown() classes.This setUp() method can hold all data and object initializations required to be used by other test casse classes.
Thus when u write a SampleTest it just extends the BaseTestCase and u can have your test methods in that.U just need to call super.setUp() and super.tearDown() in your SampleTest class's setUp() and tearDown() methods respectively.
This reduces the redundant codes present in the setUp() methods of various TestCase classes.