#11983 closed Bugs (fixed)

Boost Test XML Report contains unescaped XML characters

Reported by: m8mble <m8mble@…> Owned by: renficiaud
Milestone: Boost 1.61.0 Component: test
Version: Boost 1.60.0 Severity: Problem
Keywords: XML, Test, Report Cc:


I've encountered problems with the boost test reports in XML format. They contain unescaped characters ("<" and ">") in the TestCase? name attribute for template tests. Here is a minimal example:

#define BOOST_TEST_MODULE huhu
#include <boost/test/included/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/mpl/list.hpp>

typedef boost::mpl::list<int> types;

BOOST_AUTO_TEST_CASE_TEMPLATE( test, Type, types ) {}

When running with --report_format=XML --report_level=detailed, this will include the following in the XML report:

<TestCase name="test<i>" result="passed"...

The "<" and ">" characters inside the name attribute must be escaped according to the XML specifications.

I verified, that boost versions 1.53, 1.54 and 1.59 correctly escaped those characters. Interestingly , the unescaped characters appear in the XML report only. The XML logger is not affected for all boost versions including 1.60. When running with --log_format=XML --log_level=all any boost test version correctly prints

<TestCase name="test&lt;i&gt;" ...

Attachments (0)

Change History (4)

comment:1 Changed 16 months ago by renficiaud

  • Owner changed from rogeeff to renficiaud
  • Status changed from new to assigned

comment:2 Changed 16 months ago by renficiaud

  • Milestone changed from To Be Determined to Boost 1.61.0

comment:3 Changed 16 months ago by renficiaud

Fixed in branch topic/trac-11983-xml-escape-in-report

comment:4 Changed 16 months ago by renficiaud

  • Resolution set to fixed
  • Status changed from assigned to closed

Merged to master rev 6a3a616

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain renficiaud.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.