CppUnit project page | FAQ

XmlOutputter.h
Go to the documentation of this file.
1#ifndef CPPUNIT_XMLTESTRESULTOUTPUTTER_H
2#define CPPUNIT_XMLTESTRESULTOUTPUTTER_H
3
4#include <cppunit/Portability.h>
5
6#if CPPUNIT_NEED_DLL_DECL
7#pragma warning( push )
8#pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
9#endif
10
11#include <cppunit/Outputter.h>
12#include <deque>
13#include <map>
14#include <cppunit/portability/Stream.h>
15
16
17 CPPUNIT_NS_BEGIN
18
19
20 class Test;
21 class TestFailure;
22 class TestResultCollector;
23 class XmlDocument;
24 class XmlElement;
25 class XmlOutputterHook;
26
27
39 class CPPUNIT_API XmlOutputter : public Outputter
40{
41 public:
47 XmlOutputter( TestResultCollector *result,
48 OStream &stream,
49 const std::string& encoding = std::string("ISO-8859-1") );
50
52 virtual ~XmlOutputter();
53
57 virtual void addHook( XmlOutputterHook *hook );
58
62 virtual void removeHook( XmlOutputterHook *hook );
63
69 virtual void write();
70
76 virtual void setStyleSheet( const std::string &styleSheet );
77
86 virtual void setStandalone( bool standalone );
87
88 typedef std::map<Test *,TestFailure*, std::less<Test*> > FailedTests;
89
98 virtual void setRootNode();
99
100 virtual void addFailedTests( FailedTests &failedTests,
101 XmlElement *rootNode );
102
103 virtual void addSuccessfulTests( FailedTests &failedTests,
104 XmlElement *rootNode );
105
112 virtual void addStatistics( XmlElement *rootNode );
113
119 virtual void addFailedTest( Test *test,
120 TestFailure *failure,
121 int testNumber,
122 XmlElement *testsNode );
123
124 virtual void addFailureLocation( TestFailure *failure,
125 XmlElement *testElement );
126
127
133 virtual void addSuccessfulTest( Test *test,
134 int testNumber,
135 XmlElement *testsNode );
136 protected:
137 virtual void fillFailedTestsMap( FailedTests &failedTests );
138
139 protected:
140 typedef std::deque<XmlOutputterHook *> Hooks;
141
142 TestResultCollector *m_result;
143 OStream &m_stream;
144 std::string m_encoding;
145 std::string m_styleSheet;
146 XmlDocument *m_xml;
147 Hooks m_hooks;
148
149 private:
151 XmlOutputter( const XmlOutputter &copy );
152
154 void operator =( const XmlOutputter &copy );
155
156 private:
157};
158
159
160 CPPUNIT_NS_END
161
162#if CPPUNIT_NEED_DLL_DECL
163#pragma warning( pop )
164#endif
165
166
167#endif // CPPUNIT_XMLTESTRESULTOUTPUTTER_H
CPPUNIT_API
#define CPPUNIT_API
Definition CppUnitApi.h:27
Outputter.h
Portability.h
CPPUNIT_NS_END
#define CPPUNIT_NS_END
Definition Portability.h:106
CPPUNIT_NS_BEGIN
#define CPPUNIT_NS_BEGIN
Definition Portability.h:105
Stream.h
OStream
CPPUNIT_NS_BEGIN typedef std::ostream OStream
Definition Stream.h:330
Outputter
Abstract outputter to print test result summary.
Definition Outputter.h:14
Outputter::write
virtual void write()=0
TestFailure
Record of a failed Test execution.
Definition TestFailure.h:25
Test
Base class for all test objects.
Definition Test.h:26
TestResultCollector
Collects test result.
Definition TestResultCollector.h:32
XmlDocument
A XML Document.
Definition XmlDocument.h:28
XmlElement
A XML Element.
Definition XmlElement.h:34
XmlOutputterHook
Hook to customize Xml output.
Definition XmlOutputterHook.h:118
XmlOutputter
Outputs a TestResultCollector in XML format.
Definition XmlOutputter.h:40
XmlOutputter::m_encoding
std::string m_encoding
Definition XmlOutputter.h:144
XmlOutputter::FailedTests
std::map< Test *, TestFailure *, std::less< Test * > > FailedTests
Definition XmlOutputter.h:88
XmlOutputter::m_hooks
Hooks m_hooks
Definition XmlOutputter.h:147
XmlOutputter::XmlOutputter
XmlOutputter(const XmlOutputter &copy)
Prevents the use of the copy constructor.
XmlOutputter::m_stream
OStream & m_stream
Definition XmlOutputter.h:143
XmlOutputter::m_xml
XmlDocument * m_xml
Definition XmlOutputter.h:146
XmlOutputter::m_styleSheet
std::string m_styleSheet
Definition XmlOutputter.h:145
XmlOutputter::m_result
TestResultCollector * m_result
Definition XmlOutputter.h:142
XmlOutputter::Hooks
std::deque< XmlOutputterHook * > Hooks
Definition XmlOutputter.h:140

| Send comments to: CppUnit Developers