CppUnit project page | FAQ | CppUnit home page |
#include <TestResult.h>
Inheritance diagram for TestResult:
Public Member Functions | |
TestResult (SynchronizationObject *syncObject=0) | |
Construct a TestResult. | |
virtual | ~TestResult () |
Destroys a test result. | |
virtual void | addListener (TestListener *listener) |
virtual void | removeListener (TestListener *listener) |
virtual void | reset () |
Resets the stop flag. | |
virtual void | stop () |
Stop testing. | |
virtual bool | shouldStop () const |
Returns whether testing should be stopped. | |
virtual void | startTest (Test *test) |
Informs TestListener that a test will be started. | |
virtual void | addError (Test *test, Exception *e) |
Adds an error to the list of errors. The passed in exception caused the error. | |
virtual void | addFailure (Test *test, Exception *e) |
Adds a failure to the list of failures. The passed in exception caused the failure. | |
virtual void | endTest (Test *test) |
Informs TestListener that a test was completed. | |
virtual void | startSuite (Test *test) |
Informs TestListener that a test suite will be started. | |
virtual void | endSuite (Test *test) |
Informs TestListener that a test suite was completed. | |
virtual void | runTest (Test *test) |
Run the specified test. | |
virtual bool | protect (const Functor &functor, Test *test, const std::string &shortDescription=std::string("")) |
Protects a call to the specified functor. | |
virtual void | pushProtector (Protector *protector) |
Adds the specified protector to the protector chain. | |
virtual void | popProtector () |
Removes the last protector from the protector chain. | |
Protected Types | |
typedef CppUnitDeque< TestListener * > | TestListeners |
Protected Member Functions | |
void | addFailure (const TestFailure &failure) |
Called to add a failure to the list of failures. | |
virtual void | startTestRun (Test *test) |
virtual void | endTestRun (Test *test) |
Protected Attributes | |
TestListeners | m_listeners |
ProtectorChain * | m_protectorChain |
bool | m_stop |
Private Member Functions | |
TestResult (const TestResult &other) | |
TestResult & | operator= (const TestResult &other) |
A single instance of this class is used when running the test. It is usually created by the test runner (TestRunner).
This class shouldn't have to be inherited from. Use a TestListener or one of its subclasses to be informed of the ongoing tests. Use a Outputter to receive a test summary once it has finished
TestResult supplies a template method 'setSynchronizationObject()' so that subclasses can provide mutual exclusion in the face of multiple threads. This can be useful when tests execute in one thread and they fill a subclass of TestResult which effects change in another thread. To have mutual exclusion, override setSynchronizationObject() and make sure that you create an instance of ExclusiveZone at the beginning of each method.
|
|
|
Construct a TestResult.
|
|
Destroys a test result.
|
|
|
|
Adds an error to the list of errors. The passed in exception caused the error.
|
|
Called to add a failure to the list of failures.
Reimplemented in TextTestResult. |
|
Adds a failure to the list of failures. The passed in exception caused the failure.
|
|
|
|
Informs TestListener that a test suite was completed.
|
|
Informs TestListener that a test was completed.
|
|
|
|
|
|
Removes the last protector from the protector chain.
|
|
Protects a call to the specified functor. See Protector to understand how protector works. A default protector is always present. It captures CppUnit::Exception, std::exception and any other exceptions, retrieving as much as possible information about the exception as possible. Additional Protector can be added to the chain to support other exception types using pushProtector() and popProtector().
|
|
Adds the specified protector to the protector chain.
|
|
|
|
Resets the stop flag.
|
|
Run the specified test. Calls startTestRun(), test->run(this), and finally endTestRun(). |
|
Returns whether testing should be stopped.
|
|
Informs TestListener that a test suite will be started.
|
|
Informs TestListener that a test will be started.
Reimplemented in TextTestResult. |
|
|
|
Stop testing.
|
|
|
|
|
|
|
hosts this site. |
Send comments to: CppUnit Developers |