[Lazarus] TTestSuite
Graeme Geldenhuys
graemeg.lists at gmail.com
Tue Feb 10 16:23:12 CET 2009
On Tue, Feb 10, 2009 at 4:28 PM, Lee Jenkins <lee at datatrakpos.com> wrote:
>
> Something like this:
>
> MainTestSuite <---- Test Suite
> --SubTestSuite <---- Child Test Suite
> ----TestCase1 <---- A Test case under a TestSuite
> ----TestCase2 <---- A Test case under a TestSuite
> --SubTestSuite2
> ----TestCase3
> ----TestCase4
I would normally do the following...
------------[ unit1.pas ]------------
TTestSuite1 = class(TTestCase)
published
procedure TestCase1;
procedure TestCase2;
end;
initialization
RegisterTest('Main Test Suite', TTestSuite1);
------------[ unit2.pas ]------------
TTestSuite2 = class(TTestCase)
published
procedure TestCase1;
procedure TestCase2;
procedure TestCase3;
procedure TestCase4;
end;
initialization
RegisterTest('Main Test Suite', TTestSuite2);
Which will give you the following hierarchy:
Main Test Suite <---- Test Suite
--TTestSuite1 <---- Child Test Suite
----TestCase1 <---- A Test case under a TestSuite
----TestCase2 <---- A Test case under a TestSuite
--TTestSuite2
----TestCase1
----TestCase2
----TestCase3
----TestCase4
> Also, must I override the protected Getters for the TestSuiteName, etc. ?
No, you can normally pass them in as a parameter when they are
registered. If you want a more complex hierarchy, that is also
possible. I use more layers by using test decorators.
Also have a look at the tiFPCUnitUtils.pas unit in tiOPF. It can
create a more complex hierarchy with much less effort. Some of that
code could probably move to FPC itself.
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
More information about the Lazarus
mailing list