TextTest writes illegal char in xunit file CDATA section

Bug #1504043 reported by Magnus Lyckå on 2015-10-08
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

TextTest seems to dump unfiltered (?) text into the CDATA sections of junit result files.

<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="XXX" failures="1" tests="1" time="0" errors="0">
  <testcase name="XXX" time="0" classname="XXX">
    <failure type="differences" message="stdout different(+)">
Please don't allow e.g. form feed (#xC) here, since XML parsers will reject the file.

The following characters are allowed in CDATA ( as long as it's not ]]> ):
#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]

See http://www.w3.org/TR/REC-xml/#sec-cdata-sect and http://www.w3.org/TR/REC-xml/#NT-Char

Geoff Bache (geoff.bache) wrote :

Try to change to the following in the file texttestlib/default/batch/junitreport.py

def _longMessage(self, test):
        message = escape(test.state.freeText.replace("]]>", "END_MARKER"))
        return message

I believe you are also currently working in the same office as the original author of this code, who may be able to help further :)

Geoff Bache (geoff.bache) wrote :

Checked in the patch sent by Magnus this afternoon.

Changed in texttest:
status: New → Fix Committed
Changed in texttest:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers