Name

XmlOutputter

Description

The class XmlOutputter (see Figure C-36) is a subclass of Outputter. It gets test results from a TestResultCollector and outputs them in XML format to an output stream. The write( ) method is called to produce the output, rather than calling the other output methods directly.

XmlOutputter defines a nested class named Node representing an XML node.

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

The class XmlOutputter
Figure C-36. The class XmlOutputter

Declaration

class XmlOutputter : public Outputter

Constructors/Destructors

XmlOutputter(TestResultCollector *result, ostream &stream, string encoding = "ISO-8859-1")

Constructs an XmlOutputter to get test results from result and output them to stream. The default encoding is ASCII, also known as Latin-1 or ISO 8859-1.

virtual ~XmlOutputter( )

A destructor.

Public Methods

virtual void addFailedTest(Test *test, TestFailure *failure, int testNumber, Node *testsNode)

Creates an XML node representing the test failure and adds it to testsNode. Also calls addFailureLocation() if the test failure has a valid SourceLine.

virtual void addFailedTests(FailedTests &failedTests, Node *rootNode)

Adds the test failures from failedTests to rootNode using addFailedTest( ).

virtual void addFailureLocation(TestFailure *failure, Node *testNode)

Creates an XML node representing the test ...

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.