setTestListener

setTestListener(listener: JadeTestListenerIF);

The setTestListener method of the JadeTestRunner class identifies the object specified by the listener parameter that will listen to information about the progress and results of test methods.

The listener object must implement the methods of the JadeTestListenerIF interface, which receive information about the success or failure of test methods as they are run.

There can be, at most, one listener object for a test run. If a listener object is not specified, information about the test run is output to the Jade Interpreter Output Viewer.

The following example shows the use of the setTestListener method to specify the test listener object.

vars
    tests : ObjectArray;
    file : ListenerFile;
 // ListenerFile is a subclass of File that implements JadeTestListenerIF
    jtr : JadeTestRunner;
begin
    create file transient;
    file.mode := File.Mode_Append;
    file.fileName := "C:\UnitTests\results.txt";
    create tests transient;
    tests.add(TestCalculator);
    create jtr transient;
    jtr.setTestListener(file);
    jtr.runTests(tests);
epilog
    delete tests;
    delete file;
    delete jtr;
end;