Closed
Description
Current reporter when printing xml don't escape CDDATA when it's part of the string being printed e.g. failure message. This causing a xml to break.
Sample test:
create or replace package check_junit_reporting is
--%suite()
--%test(Test with ccdata)
procedure test_do_stuff;
end;
create or replace package body check_junit_reporting is
procedure test_do_stuff is
begin
ut.expect('1').to_equal('<![CDATA[some stuff]]>');;
end;
end;
And result
<testsuites tests="1" skipped="0" error="0" failure="1" name="" time=".078591" >
<testsuite tests="1" id="1" package="check_junit_reporting" skipped="0" error="0" failure="1" name="check_junit_reporting" time=".078326" >
<testcase classname="check_junit_reporting" assertions="2" skipped="0" error="0" failure="1" name="Test with ccdata" time=".077445" status="Failure">
<failure>
<![CDATA[
Actual: '1' (varchar2) was expected to equal: '<![CDATA[some stuff]]>' (varchar2)
"at "UT3_TESTER.CHECK_JUNIT_REPORTING.TEST_DO_STUFF", line 4 ut.expect('1').to_equal('<![CDATA[some stuff]]>');
"
]]>
</failure>
</testcase>
</testsuite>
</testsuites>
And when you validate
XML Parsing Error: not well-formed
Line Number 9, Column 52:
Since CDDATA is not really something we can escape the only solution I found was to use ]]]]><![CDATA[>
<testsuites tests="1" skipped="0" error="0" failure="1" name="" time=".078591" >
<testsuite tests="1" id="1" package="check_junit_reporting" skipped="0" error="0" failure="1" name="check_junit_reporting" time=".078326" >
<testcase classname="check_junit_reporting" assertions="2" skipped="0" error="0" failure="1" name="Test with ccdata" time=".077445" status="Failure">
<failure>
<![CDATA[
Actual: '1' (varchar2) was expected to equal: '<![CDATA[some stuff]]>' (varchar2)
"at "UT3_TESTER.CHECK_JUNIT_REPORTING.TEST_DO_STUFF", line 4 ut.expect('1').to_equal('<![CDATA[some stuff]]]]><![CDATA[>');
"
]]>
</failure>
</testcase>
</testsuite>
</testsuites>