Name

TestResultCollector

Description

The class TestResultCollector (see Figure C-27) collects test results that it receives from a TestResult via the TestListener interface. The results consist of the Test objects run and any failures or errors produced.

A TestResultCollector is a SynchronizedObject. Its operations are mutex-protected and thread-safe.

TestResultCollector belongs to the namespace CppUnit. It is declared in TestResultCollector.h and implemented in TestResultCollector.cpp.

The class TestResultCollector
Figure C-27. The class TestResultCollector

Declaration

class TestResultCollector : public TestSucessListener

Constructors/Destructors

TestResultCollector(SynchronizationObject *syncObject = 0)

A constructor. If a SynchronizationObject is not provided, a new one is created.

virtual ~TestResultCollector( )

A destructor.

Public Methods

void addFailure(const TestFailure &failure)

A method that informs TestResultCollector of a TestFailure.

virtual const TestFailures& failures( ) const

Returns m_failures, the TestFailure objects collected by this TestResultCollector.

virtual void reset( )

Clears the collected results.

virtual int runTests( ) const

Returns the number of Test objects run.

void startTest(Test *test)

A method that informs TestResultCollector that test is about to be run.

virtual int testErrors( ) const

Returns the number of test errors collected.

virtual int testFailures( ) const

Returns the number ...

Get Unit Test Frameworks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.