output cppunit to xml for bitten

master
Marc Wäckerlin 16 years ago
parent c869d6f543
commit f17c1d5995
  1. 6
      test/container_serialization_test.cxx
  2. 6
      test/serialization_test.cxx
  3. 6
      test/xml_test.cxx

@ -10,6 +10,8 @@
#include <cppunit/ui/text/TestRunner.h> #include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/XmlOutputter.h>
#include <fstream>
class A: public xml::Serialize { class A: public xml::Serialize {
public: public:
@ -163,8 +165,10 @@ class ContainerSerializationTest: public CppUnit::TestFixture {
}; };
CPPUNIT_TEST_SUITE_REGISTRATION(ContainerSerializationTest); CPPUNIT_TEST_SUITE_REGISTRATION(ContainerSerializationTest);
int main() try { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} catch (std::exception& e) { } catch (std::exception& e) {

@ -10,6 +10,8 @@
#include <cppunit/ui/text/TestRunner.h> #include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/XmlOutputter.h>
#include <fstream>
class A: public xml::Serialize { class A: public xml::Serialize {
public: public:
@ -344,8 +346,10 @@ class SerializationTest: public CppUnit::TestFixture {
}; };
CPPUNIT_TEST_SUITE_REGISTRATION(SerializationTest); CPPUNIT_TEST_SUITE_REGISTRATION(SerializationTest);
int main() try { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} catch (std::exception& e) { } catch (std::exception& e) {

@ -10,6 +10,8 @@
#include <cppunit/ui/text/TestRunner.h> #include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/XmlOutputter.h>
#include <fstream>
#include <memory> #include <memory>
class NodeTest: public CppUnit::TestFixture { class NodeTest: public CppUnit::TestFixture {
@ -443,8 +445,10 @@ class FunTest: public CppUnit::TestFixture {
}; };
CPPUNIT_TEST_SUITE_REGISTRATION(FunTest); CPPUNIT_TEST_SUITE_REGISTRATION(FunTest);
int main() try { int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1; return runner.run() ? 0 : 1;
} catch (std::exception& e) { } catch (std::exception& e) {

Loading…
Cancel
Save