[fpc-pascal] FPCUnit: TestSuiteName vs TestName
graemeg.lists at gmail.com
Mon May 21 20:39:50 CEST 2007
On 5/21/07, Dean Zobec <dean.zobec at gmail.com> wrote:
> The ATest parameter can be a TTestCase or a TTestSuite
After reading some more docs on DUnit (which is also a port of JUnit)
I found they implemented the Composite pattern. Looking a bit closer
to the FPCUnit code I came to the same conclusion whith explains a bit
> > For example in DUnit you can register a test as follows:
> > RegisterTest(cSuiteNameNonPersistentTests, ATestCaseClass.Suite);
> FSuiteName is handled automatically when the TTest descendent is added
> to a TestSuite, you don't have to set it manually.
Looking into the DUnit code I found the reason for passing in the
name. It's actually a Suite Path used to automatically create
TTestSuites for you so you can better group you tests case in a
hierarchy. You would use it if you don't want the registered test
case to appear in a top level node (like in the GUI Runner).
I have implemented the same functionality for FPCUnit (a overloaded
RegisterTest method) today. See my other message to this mailing
list. I'll create a patch for it tomorrow and see if it will make it
into 2.2 branch but I doubt - which will be a pitty as it is very
useful and helps a lot in a huge test suite like tiOPF has.
> FPCUnit has a different structure then DUnit, is a literal port of the
> JUnit test framework, with only some changes that were required to adapt
DUnit is also based on JUnit. They just followed the path using
Interfaces instead of abstract classes. In the end they are very
similar I think.
> TTest is an abstract class, TTestSuite is a composite pattern. Just look
> at the JUnit documentation, here you can find a UML diagram:
Thanks, I'll take a look at those links. I'm sure they will come in handy.
> Still, it's not a good excuse for lack of documentation :)
I won't tell anyone if you don't! ;-)
General error, hit any user to continue.
More information about the fpc-pascal