CppUnit project page FAQ CppUnit home page

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

CppUnit::TestResult Class Reference
[Tracking test execution]

Manages TestListener. More...

#include <TestResult.h>

Inheritance diagram for CppUnit::TestResult:

CppUnit::SynchronizedObject CppUnit::TextTestResult List of all members.

Public Methods

 TestResult (SynchronizationObject *syncObject=0)
 Construct a TestResult. More...

virtual ~TestResult ()
 Destroys a test result. More...

virtual void addListener (TestListener *listener)
virtual void removeListener (TestListener *listener)
virtual void reset ()
 Resets the result for a new run. More...

virtual void stop ()
 Stop testing. More...

virtual bool shouldStop () const
 Returns whether testing should be stopped. More...

virtual void startTest (Test *test)
 Informs the result that a test will be started. 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 endTest (Test *test)
 Informs the result that a test was completed. More...


Protected Types

typedef std::deque< TestListener * > TestListeners

Protected Methods

void addFailure (const TestFailure &failure)
 Called to add a failure to the list of failures. More...


Protected Attributes

TestListeners m_listeners
bool m_stop

Private Methods

 TestResult (const TestResult &other)
TestResult & operator= (const TestResult &other)

Detailed Description

Manages TestListener.

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.

See also:
Test, TestListener, TestResultCollector, Outputter.


Member Typedef Documentation

typedef std::deque<TestListener *> CppUnit::TestResult::TestListeners [protected]
 


Constructor & Destructor Documentation

CppUnit::TestResult::TestResult SynchronizationObject *    syncObject = 0
 

Construct a TestResult.

CppUnit::TestResult::~TestResult   [virtual]
 

Destroys a test result.

CppUnit::TestResult::TestResult const TestResult &    other [private]
 


Member Function Documentation

void CppUnit::TestResult::addError Test   test,
Exception   e
[virtual]
 

Adds an error to the list of errors.

The passed in exception caused the error

void CppUnit::TestResult::addFailure const TestFailure   failure [protected]
 

Called to add a failure to the list of failures.

Reimplemented in CppUnit::TextTestResult.

void CppUnit::TestResult::addFailure Test   test,
Exception   e
[virtual]
 

Adds a failure to the list of failures.

The passed in exception caused the failure.

void CppUnit::TestResult::addListener TestListener   listener [virtual]
 

void CppUnit::TestResult::endTest Test   test [virtual]
 

Informs the result that a test was completed.

TestResult& CppUnit::TestResult::operator= const TestResult &    other [private]
 

void CppUnit::TestResult::removeListener TestListener   listener [virtual]
 

void CppUnit::TestResult::reset   [virtual]
 

Resets the result for a new run.

Clear the previous run result.

bool CppUnit::TestResult::shouldStop   const [virtual]
 

Returns whether testing should be stopped.

void CppUnit::TestResult::startTest Test   test [virtual]
 

Informs the result that a test will be started.

Reimplemented in CppUnit::TextTestResult.

void CppUnit::TestResult::stop   [virtual]
 

Stop testing.


Member Data Documentation

TestListeners CppUnit::TestResult::m_listeners [protected]
 

bool CppUnit::TestResult::m_stop [protected]
 


The documentation for this class was generated from the following files:
SourceForge Logo hosts this site. Send comments to:
CppUnit Developers