[fpc-devel] FPCUnit problem - do we fix or rewrite?

Graeme Geldenhuys graemeg.lists at gmail.com
Tue May 19 12:46:56 CEST 2009


I use FPCUnit extensively at work and in open source projects like
tiOPF, but I hit a bit of a snag - actually a bug in FPCUnit which
causes many tests to fail for the wrong reasons. Here is one such case
- in the tiOPF project many database tests fail do to "Setup Once"
issues: http://opensoft.homeip.net/tiopf/fpcunit/index.html
Michael van Canneyt has also hit this bug before, but now I'm not sure
what exactly to do about it.

The bug has to do with running a "setup" or "teardown" only once. Yes
FPCUnit has the TestDecorator which adds this support, but if you have
a nested test hierarchy, the running once falls over. When doing unit
tests that share DB connections this issues becomes a major pain.

Michael had a more in-depth look at the issue and told me that the
problem lies in the heart of FPCUnit's design and is not very easy to
solve. So much so, that he recommends it is better to simply rewrite
FPCUnit than try and patch the existing code. I have not taken such a
close look to the issue, but had to modify my test hierarchy to get
around the problem (which should really not have been needed in the
first place).

Michael, do you still feel the same way about this issue?  Dean Zobec,
are you still around? FPCUnit was your baby to start with. Do you have
any comments?

I'm at cross-roads now. Do I try and solve the problem using the
current code, or do I collaborate with Michael and Dean (and anybody
else interested) and start a rewrite? If a rewrite is the preferred
option, I have a few questions

  * how will this affect all the existing FPCUnit users?
  * will (or must) the new design have a similar API so our existing
test suites will continue to run.
  * Do we make it more DUnit compatible? I already created many DUnit
compatibility methods, but some things are not possible.
  * DUnit2 (hosted in the tiOPF code repository and written by the
late Peter McNab) has some major improvements over the existing DUnit.
Do we incorporate/port that, or merge the DUnit2 code into a new
testing framework that is FPC and Delphi compatible?
  * Obviously a timeframe is also important
  * Do we use Interfaces (like DUnit and DUnit2) or do we use abstract
classes like FPCunit currently does.

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the fpc-devel mailing list