mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-18 22:26:32 +01:00
started work on a JUnit/Ant style XML output format for hooking into Hudson and similar CI servers
This commit is contained in:
parent
b46b48d006
commit
967a6807d2
5 changed files with 41 additions and 4 deletions
|
@ -17,7 +17,10 @@ cppunit_sources = framework/CppUnitException.h \
|
||||||
textui/TextTestResult.cpp \
|
textui/TextTestResult.cpp \
|
||||||
textui/TextTestResult.h \
|
textui/TextTestResult.h \
|
||||||
textui/TableTestResult.cpp \
|
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_sources = ../silly_string/silly_string.cpp \
|
||||||
../silly_string/silly_string.hpp
|
../silly_string/silly_string.hpp
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "TestRunner.hpp"
|
#include "TestRunner.hpp"
|
||||||
#include "textui/TextTestResult.h"
|
#include "textui/TextTestResult.h"
|
||||||
#include "textui/TableTestResult.hpp"
|
#include "textui/TableTestResult.hpp"
|
||||||
|
#include "textui/XmlTestResult.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
@ -45,6 +46,11 @@ bool tablerun(const string& name, Test *test, bool verbose)
|
||||||
return run<TableTestResult>(name, test, verbose);
|
return run<TableTestResult>(name, test, verbose);
|
||||||
} // tablerun
|
} // tablerun
|
||||||
|
|
||||||
|
bool xmlrun(const string& name, Test *test, bool verbose)
|
||||||
|
{
|
||||||
|
return run<XmlTestResult>(name, test, verbose);
|
||||||
|
} // xmlrun
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void printBanner ()
|
void printBanner ()
|
||||||
|
@ -85,6 +91,13 @@ bool TestRunner::run(int ac, const char **av)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(string(av[i]) == "-xml")
|
||||||
|
{
|
||||||
|
runner = xmlrun;
|
||||||
|
++opt;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
testCase = av[i];
|
testCase = av[i];
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
#include "TableTestResult.hpp"
|
#include "TableTestResult.hpp"
|
||||||
|
|
||||||
void TableTestResult::print(std::ostream& stream)
|
void TableTestResult::print(std::ostream& stream)
|
||||||
|
@ -11,4 +9,4 @@ void TableTestResult::print(std::ostream& stream)
|
||||||
<< testFailures() << "\t"
|
<< testFailures() << "\t"
|
||||||
<< testErrors() << "\t"
|
<< testErrors() << "\t"
|
||||||
<< testSkips();
|
<< testSkips();
|
||||||
} // print
|
} // print
|
||||||
|
|
9
tests/CppUnit/textui/XmlTestResult.cpp
Normal file
9
tests/CppUnit/textui/XmlTestResult.cpp
Normal 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
|
14
tests/CppUnit/textui/XmlTestResult.hpp
Normal file
14
tests/CppUnit/textui/XmlTestResult.hpp
Normal 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
|
Loading…
Reference in a new issue