Boost.Test XML Reports with Boost.Build
My previous post Using Boost.Test with Boost.Build illustrated how to build and run Boost.Tests tests with the Boost.Build build system. For my own purposes I wanted to take this one step further by integrating Boost.Test results with continuous integration builds in Pulse.
To do this, I needed to get Boost.Test to produce XML output, at the right level of detail, which can be read by Pulse. This is another topic I have covered to some extent before: the key part being to pass the arguments “–log_format=XML –log_level=test_suite” to the Boost.Test binaries. The missing link is how to achieve this using Boost.Build’s run task. Recall that the syntax for the run task is as follows:
sources + :
args * :
input-files * :
requirements * :
target-name ? :
default-build * )
Notice in particular that you can pass arguments just after the sources. So I updated my Jamfile to the following:
lib boost_unit_test_framework ;
run NumberTest.cpp /libs/number//number boost_unit_test_framework
: –log_format=XML –log_level=test_suite
;
and lo, the test output was now in XML format:
<TestLog><TestSuite name=”Number”><TestSuite name=”NumberSuite”><TestCase name=”checkPass”><TestingTime>0</TestingTime></TestCase><TestCase name=”checkFailure”><Error file=”NumberTest.cpp” line=”15″>check Number(2).add(2) == Number(5) failed [4 != 5]</Error><TestingTime>0</TestingTime></TestCase></TestSuite></TestSuite></TestLog>
*** 1 failure detected in test suite “Number”
EXIT STATUS: 201
The output will not exactly win awards: it has no <?xml …?> declaration, no formatting, and thanks to Boost.Test contains trailing junk. We’ve made sure that the processing in Pulse 2.1 takes care of this, though.
If you are a Pulse user looking to integrate Pulse and Boost.Test, you might also be interested in a new Cookbook article that I’ve written up on this topic.
This entry was posted on Thursday, December 10th, 2009 at 2:24 am and is filed under Agile, Build, C++, Continuous Integration, Technology, Testing. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.










