TTestSuite

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

TTestSuite

José Mejuto
Hello,

In the TTestSuite class when process is finished a XML is written to
stdout. If the tests may show some kind of progress information, for
manually run tests, this information must be in stdout, stderr, is there
a specific method available for progress output ?

Cheers,

        José Mejuto

--

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TTestSuite

Michael Van Canneyt


On Fri, 2 Sep 2016, José Mejuto wrote:

> Hello,
>
> In the TTestSuite class when process is finished a XML is written to
> stdout. If the tests may show some kind of progress information, for
> manually run tests, this information must be in stdout, stderr, is there
> a specific method available for progress output ?

No. But I think this could be useful.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TTestSuite

Graeme Geldenhuys-6
In reply to this post by José Mejuto
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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TTestSuite

José Mejuto
El 02/09/2016 a las 14:39, Graeme Geldenhuys escribió:

>> 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.

Hello,

Yes, but I'm writing the test so in code I can write something like:

if a=0 then FAIL('Value must not be 0');

And I wish to write something like:

if a>1 then MESSAGE('Value 2 or bigger is OK');
if a=1 then MESSAGE('Value 1 is quite dangerous');
if a=0 then FAIL('Value 0 is KBOOM!');

Because some test are sloooow and I like to have a screen feedback when
running manually in the console, but if I use the writeln this
information will pollute the generated XML to stdout. Maybe using stderr
for progress messages will be valid and that's my question, will stderr
cause pollution when the test is added to an automated test set ?

PS: I need to contact you out of the list about a project I'm finishing
and that would be of your interest. My last try looking for your email
(not mailinglists@...) was unsuccessful and never get an answer. Could
you please contact me to this email address ? Thank you.

--

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TTestSuite

Graeme Geldenhuys-6
On 2016-09-02 14:14, José Mejuto wrote:
>  but if I use the writeln this
> information will pollute the generated XML to stdout.

Why not specify a output file for the generated XML, instead of letting
it go to stdout. Run the FPCUnit console test application with the -h
parameter to see what options are available. Maybe that will help.

> Maybe using stderr
> for progress messages will be valid and that's my question, will stderr

Probably not ideal, but I guess it could work. Otherwise, try the above
(specify a XML output file), then see what happens with writeln()
statements to stdout.


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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TTestSuite

José Mejuto
El 02/09/2016 a las 15:24, Graeme Geldenhuys escribió:

>> information will pollute the generated XML to stdout.
> Why not specify a output file for the generated XML, instead of letting
> it go to stdout. Run the FPCUnit console test application with the -h
> parameter to see what options are available. Maybe that will help.

Hello,

With file output there is no problem as only the XML data is stored
there, so writeln could be valid as a progress indicator because I think
that stdout will not be used by automated tools.

Best regards and thanks.

--

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal