21

I have done a bit of Googling in this area and have found many discussions about getting Jenkins to understand boost.test's XML output format, but no canonical reference.

Some people say we simply need to use XLST to convert the XML format, others suggest the XML needs some hacking before that (Anyone have an XSL to convert Boost.Test XML logs to a presentable format?). Some suggest the xUnit plugin can natively understand boost.test XML format, others state it can't

Because my search results span 5 years, I'm conscious that things could have changed. So I'm seeking an up to date answer about the best way to use Jenkins to run and evaluate boost unit tests.

Community
  • 1
  • 1
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
  • 1
    AS I said, up-to-date is key here... please don't automatically click the "duplicate button" for a 2-year-old question unless you are sure that is still current information. – Mr. Boy May 14 '13 at 08:01
  • Have you _tried_ whether xUnit plugin can parse it? Have you _tried_ to use the xslts from the linked question? – Jan Hudec May 14 '13 at 08:19
  • It would hardly be news if some old way still worked, that doesn't mean it's the best way. – Mr. Boy May 14 '13 at 08:30
  • Well, if the module can parse it, it is the best way. If it can't but the XSLT works, than those answers are still up-to-date and there is not much point in writing another one. – Jan Hudec May 14 '13 at 10:53
  • So - it can't parse it. And every XSL file I can find is different to every other file, and none work... either they can't process the boost.test input, or their output is not understood by xunit. – Mr. Boy May 14 '13 at 15:59
  • Use Boost.Test native JUnit output, with file output using the command line option [`--logger`](http://www.boost.org/doc/libs/1_66_0/libs/test/doc/html/boost_test/utf_reference/rt_param_reference/logger.html) – Raffi Feb 14 '18 at 19:40

3 Answers3

26

xUnit parsing works for me using Jenkins 1.498, xUnit 1.52, boost 1.42. I have a new project using boost 1.53 and the XML output format appears to be the same to my all-to-humanly-error-prone eye, but since I haven't yet set up unit tests in Jenkins, I'm not 100% sure the output is compatible.

As recommended in the xUnit plugin comments, I'm running the Boost test program with:

run_test --log_format=XML --log_sink=results.xml --log_level=all --report_level=no

I have my post-build xUnit step configured to parse results.xml with the BoostTest-1.x format.

If you're still having problems, perhaps you can update your question with more details about your versions and how you generate the test output.

Dave Bacher
  • 15,652
  • 3
  • 63
  • 86
3
run_test --log_format=XML --log_sink=results.xml --log_level=all --report_level=no --result_code=no

I've added a parameter to Dave Bacher's answer because apparently Boost Test was using a non-zero exit code to indicate a test failure but Jenkins was interpreting this as a more fundamental failure, and thus stopping without processing the test results.

exit 201
Build step 'Execute Windows batch command' marked build as failure`
Antony
  • 450
  • 1
  • 4
  • 15
0

Ok, normally it works with this options. But if you are using it in large Projects and the XML file is getting too big, the XUnit plugin does not work anymore. So I had to change the log_level to test_suite. Only the errors are logged, the successful checks are not logged.

Klaus
  • 1