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 <cppunit/portability/Stream.h>
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 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
00086 virtual void setStandalone( bool standalone );
00087
00088 typedef CppUnitMap<Test *,TestFailure*, std::less<Test*> > FailedTests;
00089
00098 virtual void setRootNode();
00099
00100 virtual void addFailedTests( FailedTests &failedTests,
00101 XmlElement *rootNode );
00102
00103 virtual void addSuccessfulTests( FailedTests &failedTests,
00104 XmlElement *rootNode );
00105
00112 virtual void addStatistics( XmlElement *rootNode );
00113
00119 virtual void addFailedTest( Test *test,
00120 TestFailure *failure,
00121 int testNumber,
00122 XmlElement *testsNode );
00123
00124 virtual void addFailureLocation( TestFailure *failure,
00125 XmlElement *testElement );
00126
00127
00133 virtual void addSuccessfulTest( Test *test,
00134 int testNumber,
00135 XmlElement *testsNode );
00136 protected:
00137 virtual void fillFailedTestsMap( FailedTests &failedTests );
00138
00139 protected:
00140 typedef CppUnitDeque<XmlOutputterHook *> Hooks;
00141
00142 TestResultCollector *m_result;
00143 OStream &m_stream;
00144 std::string m_encoding;
00145 std::string m_styleSheet;
00146 XmlDocument *m_xml;
00147 Hooks m_hooks;
00148
00149 private:
00151 XmlOutputter( const XmlOutputter © );
00152
00154 void operator =( const XmlOutputter © );
00155
00156 private:
00157 };
00158
00159
00160 CPPUNIT_NS_END
00161
00162 #if CPPUNIT_NEED_DLL_DECL
00163 #pragma warning( pop )
00164 #endif
00165
00166
00167 #endif // CPPUNIT_XMLTESTRESULTOUTPUTTER_H