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 ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In Jenkins, after the CMake part (probably made through the CMake plugin), add the following batch script, or adapt for builds on Linux :
build_32is the Build Directory in the CMake pluginTestsis the subdirectory where all my tests live-T Testmakes CTest output in XML (?!)verify >nulresets 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/TAGfile, 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.xmlWell, 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:… ? )