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 <cppunit/portability/CppUnitDeque.h>
13 #include <cppunit/portability/CppUnitMap.h>
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 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 CppUnitMap<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 CppUnitDeque<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
XmlOutputter::m_xml
XmlDocument * m_xml
Definition: XmlOutputter.h:146
Portability.h
XmlOutputter::m_styleSheet
std::string m_styleSheet
Definition: XmlOutputter.h:145
XmlOutputter::m_result
TestResultCollector * m_result
Definition: XmlOutputter.h:142
CppUnitMap.h
XmlOutputter
Outputs a TestResultCollector in XML format.Save the test result as a XML stream. ...
Definition: XmlOutputter.h:39
XmlOutputter::Hooks
CppUnitDeque< XmlOutputterHook * > Hooks
Definition: XmlOutputter.h:140
XmlOutputter::m_hooks
Hooks m_hooks
Definition: XmlOutputter.h:147
OStream
CPPUNIT_NS_BEGIN typedef std::ostream OStream
Definition: Stream.h:330
XmlElement
A XML Element.
Definition: XmlElement.h:33
Test
Base class for all test objects.All test objects should be a subclass of Test. Some test objects...
Definition: Test.h:25
Outputter.h
XmlOutputter::FailedTests
CppUnitMap< Test *, TestFailure *, std::less< Test * > > FailedTests
Definition: XmlOutputter.h:88
XmlDocument
A XML Document.
Definition: XmlDocument.h:27
TestFailure
Record of a failed Test execution.A TestFailure collects a failed test together with the caught excep...
Definition: TestFailure.h:24
Outputter::write
virtual void write()=0
XmlOutputter::m_encoding
std::string m_encoding
Definition: XmlOutputter.h:144
CPPUNIT_NS_END
#define CPPUNIT_NS_END
Definition: Portability.h:120
TestResultCollector
Collects test result.A TestResultCollector is a TestListener which collects the results of executing ...
Definition: TestResultCollector.h:36
CPPUNIT_NS_BEGIN
#define CPPUNIT_NS_BEGIN
Definition: Portability.h:119
Outputter
Abstract outputter to print test result summary.
Definition: Outputter.h:13
XmlOutputterHook
Hook to customize Xml output.
Definition: XmlOutputterHook.h:117
XmlOutputter::m_stream
OStream & m_stream
Definition: XmlOutputter.h:143
Stream.h
CppUnitDeque.h
CPPUNIT_API
#define CPPUNIT_API
Definition: CppUnitApi.h:27

| Send comments to: CppUnit Developers