[fpc-pascal] DUnit2 ported to Free Pascal

Graeme Geldenhuys graemeg at opensoft.homeip.net
Thu Jul 16 11:09:13 CEST 2009

Hi All,

Just thought I would let you know I successfully ported the DUnit2 code
to Free Pascal. FPCUnit has some nice features and is included with FPC,
but in its current state, there are some major headaches (defects).
Michael Van Canneyt is going to work on fixing up FPCUnit (and I'll try 
and help where I can), but I thought it quicker to simply port DUnit2 - 
Peter McNab seems to have done some excellent work with it.

The DUnit2 port also includes the XML results listener and the Text Test
Runner (no working GUI Test Runner yet - well I haven't tested it
really). Some small sample test cases shows that the test framework is
working, but an exhaustive test suite still needs to be applied - like
the tiOPF test suite. Any help with testing the framework would be much 
appreciated. I'll start putting together a self-testing test suite as well.

The original DUnit2 code is hosted in the tiOPF repository, but I did 
not want to make changes there because other projects outside the tiOPF 
might be using it. So I folked the project and am currently hosting it 
on GitHub.

Some major things I have done to DUnit2 so far:

   * No need for Delphi.NET support. The product doesn't exist any more
     and .NET has its own testing framework anyway, called NUnit.
   * Don't need prior to Delphi 7 support - it's time to upgrade or
     switch to FPC compiler.
   * Must have Free Pascal Compiler (FPC) support.
   * With FPC support comes the idea that it must be cross-platform
     friendly as well.
   * Hence the next item - removing the idea of writing to the Windows
     Registry. INI or XML config files to a great job, are easy to edit
     and works for all OS platforms.
   * Removed Jedi JCL dependencies. My thoughts were that memory leak
     detection is more important in your actual project, not the test
     suite. But I could be wrong - raise your hands if you disagree.

Other things I still need to do is neaten up the cross-compiler (FPC & 
Delphi) support - there are a few "ifdef FPC else..." cases. Plus Delphi 
testing must still be done but I can't see any issues there.

Overall, I think I got the bulk of the work done. What's left is testing
with a bigger test suite and making sure dreaded FPCUnit issues don't
appear (Test Decorators being on the top of my list).

So I welcome anybody to give the code a try and put it through its 
paces. That way all potential defects could be ironed out in a short 
time as possible. Any patches or suggestions are welcome. ;-)

To pull a copy for yourself.

    $ git clone git://github.com/graemeg/dunit2.git dunit2

And if you are stuck behind a firewall you can do the following, but I
suggest you ask your network admin to poke a hole in the firewall (port
9418). The 'git' protocol is a LOT faster and efficient than HTTP.
Anyway, there is the HTTP alternative.

    $ git clone http://github.com/graemeg/dunit2.git dunit2

   - Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

More information about the fpc-pascal mailing list