Unit Test Frameworks
TextOutputter |
Description
The class TextOutputter (see Figure C-34) is a subclass of Outputter . It gets test results from a TestResultCollector and outputs them in text format to an output stream.
TextOutputter belongs to the namespace CppUnit . It is declared in TextOutputter.h and implemented in TextOutputter.cpp .
Figure C-34. The class TextOutputter
Declaration
class TextOutputter : public Outputter
Constructors/Destructors
-
- TextOutputter(TestResultCollector *result, ostream & stream)
-
Creates a TextOutputter to get test results from result and output them to stream .
-
- virtual ~TextOutputter( )
-
A destructor.
Public Methods
-
- virtual void printFailure(TestFailure *failure, int failureNumber)
-
- virtual void printFailureDetail(Exception *thrownException)
-
- virtual void printFailureListMark(int failureNumber)
-
- virtual void printFailureLocation(SourceLine sourceLine)
-
- virtual void printFailures( )
-
- virtual void printFailureTestName(TestFailure *failure)
-
- virtual void printFailureType(TestFailure *failure)
-
- virtual void printFailureWarning( )
-
- virtual void printHeader( )
-
- virtual void printStatistics( )
-
Methods that print various portions of the test results to m_stream . Generally, the write() method is called instead of calling these methods directly.
-
- void write( )
-
A method called to output results. Calls printHeader() and printFailures( ) .
Protected/Private Methods
-
- TextOutputter(const TextOutputter& copy)
-
A copy constructor, scoped private to prevent its use.
-
- void operator=(const TextOutputter& copy)
-
A copy operator, scoped private to prevent its use.
Attributes
-
- TestResultCollector *m_result
-
The TestResultCollector passed in the constructor. ( private )
-
- ostream& m_stream
-
The output stream passed in the constructor. ( private )