Name

TextTestProgressListener

Description

The class TextTestProgressListener (see Figure C-35) is a subclass of TestListener. It prints a textual “progress bar” indicating the progress of a series of tests as they are run. A sample of its output is shown here:

....F...E...

This shows that 10 tests were run, and 1 failure and 1 error occurred.

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

The class TextTestProgressListener
Figure C-35. The class TextTestProgressListener

Declaration

class TextTestProgressListener : public TestListener

Constructors/Destructors

TextTestProgressListener( )

A constructor.

virtual ~TextTestProgressListener( )

A destructor.

Public Methods

void addFailure(const TestFailure &failure)

A method that informs TextTestProgressListener of a TestFailure. If the TestFailure is an assertion failure, an F is printed; otherwise, an E is printed.

void done( )

Prints a carriage return and flushes the output stream to complete the output.

void startTest(Test *test)

A method that informs TextTestProgressListener that a Test is about to be run. A period (.) is printed to indicate progress.

Protected/Private Methods

TextTestProgressListener(const TextTestProgressListener& copy)

A copy constructor, scoped private to prevent its use.

void operator=(const TextTestProgressListener& copy)

A copy operator, scoped private ...

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.