00001
#ifndef CPPUNIT_XMLTESTRESULTOUTPUTTER_H
00002
#define CPPUNIT_XMLTESTRESULTOUTPUTTER_H
00003
00004
#include <cppunit/Portability.h>
00005
00006
#if CPPUNIT_NEED_DLL_DECL
00007
#pragma warning( push )
00008
#pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
00009
#endif
00010
00011
#include <cppunit/Outputter.h>
00012
#include <cppunit/portability/CppUnitDeque.h>
00013
#include <cppunit/portability/CppUnitMap.h>
00014
#include <iostream>
00015
00016
00017
CPPUNIT_NS_BEGIN
00018
00019
00020
class Test;
00021
class TestFailure;
00022
class TestResultCollector;
00023
class XmlDocument;
00024
class XmlElement;
00025
class XmlOutputterHook;
00026
00027
00039 class CPPUNIT_API XmlOutputter :
public Outputter
00040 {
00041
public:
00047 XmlOutputter(
TestResultCollector *result,
00048 std::ostream &stream,
00049 std::string encoding = std::string(
"ISO-8859-1") );
00050
00052
virtual ~XmlOutputter();
00053
00057
virtual void addHook(
XmlOutputterHook *hook );
00058
00062
virtual void removeHook(
XmlOutputterHook *hook );
00063
00069
virtual void write();
00070
00076
virtual void setStyleSheet(
const std::string &styleSheet );
00077
00078
00079 typedef CppUnitMap<Test *,TestFailure*, std::less<Test*> >
FailedTests;
00080
00089
virtual void setRootNode();
00090
00091
virtual void addFailedTests( FailedTests &failedTests,
00092
XmlElement *rootNode );
00093
00094
virtual void addSuccessfulTests( FailedTests &failedTests,
00095
XmlElement *rootNode );
00096
00103
virtual void addStatistics(
XmlElement *rootNode );
00104
00110
virtual void addFailedTest(
Test *test,
00111
TestFailure *failure,
00112
int testNumber,
00113
XmlElement *testsNode );
00114
00115
virtual void addFailureLocation(
TestFailure *failure,
00116
XmlElement *testElement );
00117
00118
00124
virtual void addSuccessfulTest(
Test *test,
00125
int testNumber,
00126
XmlElement *testsNode );
00127
protected:
00128
virtual void fillFailedTestsMap( FailedTests &failedTests );
00129
00130
protected:
00131 typedef CppUnitDeque<XmlOutputterHook *> Hooks;
00132
00133 TestResultCollector *m_result;
00134 std::ostream &m_stream;
00135 std::string m_encoding;
00136 std::string m_styleSheet;
00137 XmlDocument *m_xml;
00138 Hooks m_hooks;
00139
00140
private:
00142 XmlOutputter(
const XmlOutputter © );
00143
00145
void operator =(
const XmlOutputter © );
00146
00147
private:
00148 };
00149
00150
00151
CPPUNIT_NS_END
00152
00153
#if CPPUNIT_NEED_DLL_DECL
00154
#pragma warning( pop )
00155
#endif
00156
00157
00158
#endif // CPPUNIT_XMLTESTRESULTOUTPUTTER_H