From c50058d6bbde33efa7dd831f6cac82cdcb21c9ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <peckato1@fit.cvut.cz> Date: Sat, 11 Oct 2014 14:17:34 +0200 Subject: [PATCH] CppUnit - Output XML results For better Jenkins CI integration. --- .gitignore | 2 ++ alib2algo/makefile | 4 ++-- alib2algo/test-src/main.cpp | 5 +++++ alib2data/makefile | 4 ++-- alib2data/test-src/main.cpp | 5 +++++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 114ace6b59..c33629eade 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,5 @@ doc/* **/test-obj **/test-obj-release **/test-obj-debug + +**/CppUnitTestResults.xml diff --git a/alib2algo/makefile b/alib2algo/makefile index b3c532f9b4..8b7f1304ba 100644 --- a/alib2algo/makefile +++ b/alib2algo/makefile @@ -211,10 +211,10 @@ unit-test-release: build-tests-release 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: - $(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 diff --git a/alib2algo/test-src/main.cpp b/alib2algo/test-src/main.cpp index 1b3e032257..2d574dd5c4 100644 --- a/alib2algo/test-src/main.cpp +++ b/alib2algo/test-src/main.cpp @@ -4,6 +4,7 @@ #include <cppunit/ui/text/TestRunner.h> #include <cppunit/TestResultCollector.h> #include <cppunit/TestResult.h> +#include <cppunit/XmlOutputter.h> #include <cppunit/Test.h> #include <cppunit/TestFailure.h> @@ -116,5 +117,9 @@ int main(int , char*[]) progressListener.printResults(); + std::ofstream xmlFileResults("CppUnitTestResults.xml"); + CppUnit::XmlOutputter xmlOut(&result, xmlFileResults); + xmlOut.write(); + return progressListener.getResult(); } diff --git a/alib2data/makefile b/alib2data/makefile index 9eb63cd1a4..004ebccf83 100644 --- a/alib2data/makefile +++ b/alib2data/makefile @@ -209,10 +209,10 @@ unit-test-release: build-tests-release 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: - $(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 diff --git a/alib2data/test-src/main.cpp b/alib2data/test-src/main.cpp index e31754f2d5..698cd0fc74 100644 --- a/alib2data/test-src/main.cpp +++ b/alib2data/test-src/main.cpp @@ -4,6 +4,7 @@ #include <cppunit/ui/text/TestRunner.h> #include <cppunit/TestResultCollector.h> #include <cppunit/TestResult.h> +#include <cppunit/XmlOutputter.h> #include <cppunit/Test.h> #include <cppunit/TestFailure.h> @@ -115,5 +116,9 @@ int main(int , char*[]) progressListener.printResults(); + std::ofstream xmlFileResults("CppUnitTestResults.xml"); + CppUnit::XmlOutputter xmlOut(&result, xmlFileResults); + xmlOut.write(); + return progressListener.getResult(); } -- GitLab