started work on a JUnit/Ant style XML output format for hooking into Hudson and similar CI servers

This commit is contained in:
Jez Higgins 2010-01-11 17:02:11 +00:00
parent b46b48d006
commit 967a6807d2
5 changed files with 41 additions and 4 deletions

View file

@ -17,7 +17,10 @@ cppunit_sources = framework/CppUnitException.h \
textui/TextTestResult.cpp \
textui/TextTestResult.h \
textui/TableTestResult.cpp \
textui/TableTestResult.hpp
textui/TableTestResult.hpp \
textui/XmlTestResult.cpp \
textui/XmlTestResult.hpp
silly_string_sources = ../silly_string/silly_string.cpp \
../silly_string/silly_string.hpp

View file

@ -1,6 +1,7 @@
#include "TestRunner.hpp"
#include "textui/TextTestResult.h"
#include "textui/TableTestResult.hpp"
#include "textui/XmlTestResult.hpp"
#include <iostream>
//////////////////////////////////////////
@ -45,6 +46,11 @@ bool tablerun(const string& name, Test *test, bool verbose)
return run<TableTestResult>(name, test, verbose);
} // tablerun
bool xmlrun(const string& name, Test *test, bool verbose)
{
return run<XmlTestResult>(name, test, verbose);
} // xmlrun
void printBanner ()
@ -85,6 +91,13 @@ bool TestRunner::run(int ac, const char **av)
continue;
}
if(string(av[i]) == "-xml")
{
runner = xmlrun;
++opt;
continue;
}
testCase = av[i];

View file

@ -1,5 +1,3 @@
#include "TableTestResult.hpp"
void TableTestResult::print(std::ostream& stream)
@ -11,4 +9,4 @@ void TableTestResult::print(std::ostream& stream)
<< testFailures() << "\t"
<< testErrors() << "\t"
<< testSkips();
} // print
} // print

View file

@ -0,0 +1,9 @@
#include "XmlTestResult.hpp"
void XmlTestResult::print(std::ostream& stream)
{
stream << "<testsuite tests='" << runTests() << "' skips='" << testSkips() << "' " << " failures='" << testFailures() << "' errors='" << testErrors() << "'>\n"
<< "</testsuite>";
} // print

View file

@ -0,0 +1,14 @@
#ifndef CPPUNIT_XmlTestResult_HPP
#define CPPUNIT_XmlTestResult_HPP
#include "TextTestResult.h"
class XmlTestResult : public TextTestResult
{
public:
XmlTestResult(const std::string& name, bool verbose) : TextTestResult(name, verbose) { }
virtual void print(std::ostream& stream);
}; // XmlTestResult
#endif