Opened 3 years ago

Closed 3 years ago

#11983 closed Bugs (fixed)

Boost Test XML Report contains unescaped XML characters

Reported by: m8mble <m8mble@…> Owned by: Raffi Enficiaud
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;" ...

Change History (4)

comment:1 Changed 3 years ago by Raffi Enficiaud

Owner: changed from Gennadiy Rozental to Raffi Enficiaud
Status: newassigned

comment:2 Changed 3 years ago by Raffi Enficiaud

Milestone: To Be DeterminedBoost 1.61.0

comment:3 Changed 3 years ago by Raffi Enficiaud

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

comment:4 Changed 3 years ago by Raffi Enficiaud

Resolution: fixed
Status: assignedclosed

Merged to master rev 6a3a616

Note: See TracTickets for help on using tickets.