[Lazarus] TTestSuite

Lee Jenkins lee at datatrakpos.com
Tue Feb 10 15:28:46 CET 2009


Graeme Geldenhuys wrote:
> On Tue, Feb 10, 2009 at 6:02 AM, Lee Jenkins <lee at datatrakpos.com> wrote:
>> Would anyone mind providing a simple example or useful link?  I've already
>> looked at this:
> 
> Lee, did you not look at the tiOPF test suite?  ;-)
> 

No actually, I did not.  I'll definitely take a look.

> Do you mean the following....
> 
> 
>   TMoneyTest = class(TTestCase)
>   protected
>     procedure SetUp; override;
>     procedure TearDown; override;
>   published
>     procedure testBagCreate;
>     procedure testBagMultiply;
>     procedure testBagNegate;
>     procedure testBagSimpleAdd;
>     procedure testBagSubtract;
>     procedure testBagSumAdd;
>     ....
>   end.
> 
> initialization
>   RegisterTests([TMoneyTest]);
> 
> 

Perhaps I have misunderstood what TTestSuite is.  My understanding is that 
TTestSuite is used to provide a way to group other TTestCase's so that you can 
end up with a hierarchical structure of a complete TTestSuite.

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

If this is the case, my problem is I don't see how they are related to each 
together.  In the TestSuite, how do I register the child Testcases?

Also, must I override the protected Getters for the TestSuiteName, etc. ?

--
Warm Regards,

Lee



More information about the Lazarus mailing list