| CppUnit project page | FAQ | 
Listener for test progress and result. More...
#include <TestListener.h>

| Public Member Functions | |
| virtual | ~TestListener () | 
| virtual void | startTest (Test *) | 
| Called when just before a TestCase is run.  More... | |
| virtual void | addFailure (const TestFailure &) | 
| Called when a failure occurs while running a test.  More... | |
| virtual void | endTest (Test *) | 
| Called just after a TestCase was run (even if a failure occured).  More... | |
| virtual void | startSuite (Test *) | 
| Called by a TestComposite just before running its child tests.  More... | |
| virtual void | endSuite (Test *) | 
| Called by a TestComposite after running its child tests.  More... | |
| virtual void | startTestRun (Test *, TestResult *) | 
| Called by a TestRunner before running the test.  More... | |
| virtual void | endTestRun (Test *, TestResult *) | 
| Called by a TestRunner after running the test.  More... | |
Listener for test progress and result.
Implementing the Observer pattern a TestListener may be registered to a TestResult to obtain information on the testing progress. Use specialized sub classes of TestListener for text output (TextTestProgressListener). Do not use the Listener for the test result output, use a subclass of Outputter instead.
The test framework distinguishes between failures and errors. A failure is anticipated and checked for with assertions. Errors are unanticipated problems signified by exceptions that are not generated by the framework.
Here is an example to track test time:
And another example that track failure/success at test suite level and captures the TestPath of each suite:
| 
 | inlinevirtual | 
| 
 | inlinevirtual | 
Called when a failure occurs while running a test.
Reimplemented in TestResultCollector, TestSuccessListener, TextTestProgressListener, TextTestResult, and BriefTestProgressListener.
| 
 | inlinevirtual | 
Called by a TestComposite after running its child tests.
| 
 | inlinevirtual | 
Called just after a TestCase was run (even if a failure occured).
Reimplemented in BriefTestProgressListener.
| 
 | inlinevirtual | 
Called by a TestRunner after running the test.
TextTestProgressListener use this to emit a line break. You can also use this to do some global uninitialisation.
| test | Test that was run. | 
| eventManager | Event manager used for the test run. | 
Reimplemented in TextTestProgressListener.
| 
 | inlinevirtual | 
Called by a TestComposite just before running its child tests.
| 
 | inlinevirtual | 
Called when just before a TestCase is run.
Reimplemented in TestResultCollector, TextTestResult, TextTestProgressListener, and BriefTestProgressListener.
| 
 | inlinevirtual | 
Called by a TestRunner before running the test.
You can use this to do some global initialisation. A listener could also use to output a 'prolog' to the test run.
| test | Test that is going to be run. | 
| eventManager | Event manager used for the test run. | 
| Send comments to: CppUnit Developers |