diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/test/test.cpp b/test/test.cpp index 78983217..53ee3a89 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -24,15 +24,42 @@ * $Id$ */ +#include <fstream> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TextTestRunner.h> +#include <cppunit/TestResult.h> +#include <cppunit/TestResultCollector.h> +#include <cppunit/BriefTestProgressListener.h> +#include <cppunit/XmlOutputter.h> +#include <cppunit/TextOutputter.h> int main(int argc, char **argv) { CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); + // Create the event manager and test controller + CppUnit::TestResult controller; + + // Add a listener that colllects test result + CppUnit::TestResultCollector result; + controller.addListener(&result); + + // Add a listener that print dots as test run. + CppUnit::BriefTestProgressListener progress; + controller.addListener(&progress); + CppUnit::TextTestRunner runner; runner.addTest(registry.makeTest()); - runner.run(); - return 0; + runner.run(controller); + + CppUnit::TextOutputter outputter(&result, std::cout); + outputter.write(); + + std::fstream filestr; + filestr.open ("test.xml", std::fstream::out | std::fstream::trunc); + CppUnit::XmlOutputter xml_outputter(&result, filestr); + xml_outputter.write(); + filestr.close(); + + return result.testFailuresTotal(); } |