[fpc-pascal] TTestSuite
Graeme Geldenhuys
mailinglists at geldenhuys.co.uk
Fri Sep 2 14:39:57 CEST 2016
On 2016-09-02 00:48, José Mejuto wrote:
> If the tests may show some kind of progress information
I'm assuming you are talking about FPCUnit?
If so, there is already a test progress listener implemented in the form
of the TProgressWriter class (see the consoletestrunner.pas unit).
Simply run your test suite from the command line and specify the -p (or
--progress) command line parameter.
If that's not the output you need, simply define a new class that
implements the ITestListener interface and let any of the following
methods output the information you need.
{ ITestListener interface requirements }
procedure AddFailure(ATest: TTest; AFailure: TTestFailure);
procedure AddError(ATest: TTest; AError: TTestFailure);
procedure StartTest(ATest: TTest);
procedure EndTest(ATest: TTest);
procedure StartTestSuite(ATestSuite: TTestSuite);
procedure EndTestSuite(ATestSuite: TTestSuite);
I used to have multiple listener class for various "progress output". It
takes a minute or two to put a new class together.
Alternatively, there is also the FPTest framework. It's console test
runner also has test progress output and also use a ITestListener
interface. In fact, I modelled the FPCUnit implementation based on
DUnit2 (FPTest is a fork of DUnit2).
Regards,
Graeme
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
My public PGP key: http://tinyurl.com/graeme-pgp
More information about the fpc-pascal
mailing list