I'm using CTest (part of CMake) for my automated tests.
How do I get CTest results in the Jenkins dashboard ? Or, phrased differently, how do I get CTest to output in JUnit-like XML ?
I'm using CTest (part of CMake) for my automated tests.
How do I get CTest results in the Jenkins dashboard ? Or, phrased differently, how do I get CTest to output in JUnit-like XML ?
In Jenkins, after the CMake part (probably made through the CMake plugin), add the following batch script, or adapt for builds on Linux :
build_32
is the Build Directory in the CMake pluginTests
is the subdirectory where all my tests live-T Test
makes CTest output in XML (?!)verify >nul
resets errorlevel to 0, because CTest returns >0 if any test fails, which Jenkins interprets as "the whole build failed", which we don't wantThe python script looks like this (hacked together in 10 min, beware) :
Testing/TAG
file, hence the additional fopenThe xsl looks like this. It's pretty minimal but gets the job done : [EDIT] see MOnsDaR 's improved version : http://pastebin.com/3mQ2ZQfa
Finally, check "Publish JUnit tests results" (or similar, my version is in French) and set the xml path to
build_32/JUnitTestResults.xml
Well, that was ugly. But still, hope this helps someone. And improvements are welcome ( running ctest from python maybe ? Using the path of the Python plugin instead of C:... ? )