Skip to content
Snippets Groups Projects
Commit c50058d6 authored by Tomáš Pecka's avatar Tomáš Pecka
Browse files

CppUnit - Output XML results

For better Jenkins CI integration.
parent 52f81583
No related branches found
No related tags found
No related merge requests found
...@@ -49,3 +49,5 @@ doc/* ...@@ -49,3 +49,5 @@ doc/*
**/test-obj **/test-obj
**/test-obj-release **/test-obj-release
**/test-obj-debug **/test-obj-debug
**/CppUnitTestResults.xml
...@@ -211,10 +211,10 @@ unit-test-release: build-tests-release ...@@ -211,10 +211,10 @@ unit-test-release: build-tests-release
   
   
clean-debug: clean-debug:
$(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug $(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml
   
clean-release: clean-release:
$(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release $(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml
   
   
   
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <cppunit/ui/text/TestRunner.h> #include <cppunit/ui/text/TestRunner.h>
#include <cppunit/TestResultCollector.h> #include <cppunit/TestResultCollector.h>
#include <cppunit/TestResult.h> #include <cppunit/TestResult.h>
#include <cppunit/XmlOutputter.h>
   
#include <cppunit/Test.h> #include <cppunit/Test.h>
#include <cppunit/TestFailure.h> #include <cppunit/TestFailure.h>
...@@ -116,5 +117,9 @@ int main(int , char*[]) ...@@ -116,5 +117,9 @@ int main(int , char*[])
   
progressListener.printResults(); progressListener.printResults();
   
std::ofstream xmlFileResults("CppUnitTestResults.xml");
CppUnit::XmlOutputter xmlOut(&result, xmlFileResults);
xmlOut.write();
return progressListener.getResult(); return progressListener.getResult();
} }
...@@ -209,10 +209,10 @@ unit-test-release: build-tests-release ...@@ -209,10 +209,10 @@ unit-test-release: build-tests-release
   
   
clean-debug: clean-debug:
$(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug $(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml
   
clean-release: clean-release:
$(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release $(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml
   
   
   
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <cppunit/ui/text/TestRunner.h> #include <cppunit/ui/text/TestRunner.h>
#include <cppunit/TestResultCollector.h> #include <cppunit/TestResultCollector.h>
#include <cppunit/TestResult.h> #include <cppunit/TestResult.h>
#include <cppunit/XmlOutputter.h>
   
#include <cppunit/Test.h> #include <cppunit/Test.h>
#include <cppunit/TestFailure.h> #include <cppunit/TestFailure.h>
...@@ -115,5 +116,9 @@ int main(int , char*[]) ...@@ -115,5 +116,9 @@ int main(int , char*[])
   
progressListener.printResults(); progressListener.printResults();
   
std::ofstream xmlFileResults("CppUnitTestResults.xml");
CppUnit::XmlOutputter xmlOut(&result, xmlFileResults);
xmlOut.write();
return progressListener.getResult(); return progressListener.getResult();
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment