CppUnit project page | FAQ | CppUnit home page |
#include <TestResult.h>
Inheritance diagram for CppUnit::TestResult:
Public Methods | |
TestResult () | |
Construct a TestResult. More... | |
virtual | ~TestResult () |
Destroys a test result. More... | |
virtual void | addError (Test *test, Exception *e) |
Adds an error to the list of errors. More... | |
virtual void | addFailure (Test *test, Exception *e) |
Adds a failure to the list of failures. More... | |
virtual void | startTest (Test *test) |
Informs the result that a test will be started. More... | |
virtual void | endTest (Test *test) |
Informs the result that a test was completed. More... | |
virtual int | runTests () |
Gets the number of run tests. More... | |
virtual int | testErrors () |
Gets the number of detected errors. More... | |
virtual int | testFailures () |
Gets the number of detected failures. More... | |
virtual bool | wasSuccessful () |
Returns whether the entire test was successful or not. More... | |
virtual bool | shouldStop () |
Returns whether testing should be stopped. More... | |
virtual void | stop () |
Stop testing. More... | |
virtual std::vector< TestFailure *> & | errors () |
Returns a vector of the errors. More... | |
virtual std::vector< TestFailure *> & | failures () |
Returns a vector of the failures. More... | |
virtual void | addListener (TestListener *listener) |
virtual void | removeListener (TestListener *listener) |
Protected Methods | |
virtual void | setSynchronizationObject (SynchronizationObject *syncObject) |
Accept a new synchronization object for protection of this instance TestResult assumes ownership of the object. More... | |
Protected Attributes | |
std::vector< TestFailure *> | m_errors |
std::vector< TestFailure *> | m_failures |
std::vector< TestListener *> | m_listeners |
int | m_runTests |
bool | m_stop |
SynchronizationObject * | m_syncObject |
Private Methods | |
TestResult (const TestResult &other) | |
TestResult & | operator= (const TestResult &other) |
It is an instance of the Collecting Parameter pattern.
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.
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 Reimplemented in CppUnit::TextTestResult. |
|
Adds a failure to the list of failures. The passed in exception caused the failure. Reimplemented in CppUnit::TextTestResult. |
|
|
|
Informs the result that a test was completed.
|
|
Returns a vector of the errors.
|
|
Returns a vector of the failures.
|
|
|
|
|
|
Gets the number of run tests.
|
|
Accept a new synchronization object for protection of this instance TestResult assumes ownership of the object.
|
|
Returns whether testing should be stopped.
|
|
Informs the result that a test will be started.
Reimplemented in CppUnit::TextTestResult. |
|
Stop testing.
|
|
Gets the number of detected errors.
|
|
Gets the number of detected failures.
|
|
Returns whether the entire test was successful or not.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hosts this site. |
Send comments to: CppUnit Developers |