On Sun, Dec 7, 2008 at 12:10 PM, Marc Santhoff <[EMAIL PROTECTED]> wrote: > > Yes, I agree. But if I do the same reading process in the readers source > and in the test case I have two spots having the same code. Fixing > errors or making changes at one place only would be nice. > > How could I solve this problem in a better way?
By using Setup() or TearDown(). You can also use class inheritance. Create TTestCase descendants implementing your readers source. Then create your actual test cases, using that new class, instead of TTestCase directly. eg: TTestCase | TMyBaseReaderTestClass <------ will contain your reader code | TReaderTestCase <-- will contain your actual tests or TReaderTestCase = class(TTestCase) public procedure Setup; <--- reader setup code here procedure TearDown; published procedure TestOne; procedure TestTwo; .... end; Setup() and TearDown() will be called automatically before and after each test. Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal