| 1 |
@issue |
| 2 |
@junit |
| 3 |
@wip |
| 4 |
Feature: Issue #510 -- JUnit XML output is not well-formed (in some cases) |
| 5 |
|
| 6 |
. Special control characters in JUnit stdout/stderr sections |
| 7 |
. are directly written to CDATA XML sections. |
| 8 |
. |
| 9 |
. According to the XML charset specification only the following unicode |
| 10 |
. codepoints (characters) are allowed in a CDATA section: |
| 11 |
. |
| 12 |
. Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] |
| 13 |
. /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */ |
| 14 |
. |
| 15 |
. [XML-charsets] "The normative reference is XML 1.0 (Fifth Edition), |
| 16 |
. section 2.2, https://www.w3.org/TR/REC-xml/#charsets |
| 17 |
|
| 18 |
|
| 19 |
@use.with_xmllint=yes |
| 20 |
@xfail |
| 21 |
Scenario: |
| 22 |
Given a new working directory |
| 23 |
And a file named "features/steps/special_char_steps.py" with: |
| 24 |
""" |
| 25 |
# -*- coding: UTF-8 -*- |
| 26 |
from __future__ import print_function |
| 27 |
from behave import step |
| 28 |
|
| 29 |
@step(u'we print ^D') |
| 30 |
def step_print_special_char_control_d(context): |
| 31 |
print(u"\004") |
| 32 |
""" |
| 33 |
And a file named "features/special_char.feature" with: |
| 34 |
""" |
| 35 |
Feature: An illegal char |
| 36 |
Scenario: Control-D |
| 37 |
When we print ^D |
| 38 |
""" |
| 39 |
When I run "behave --junit features/special_char.feature" |
| 40 |
Then it should pass with: |
| 41 |
""" |
| 42 |
1 scenario passed, 0 failed, 0 skipped |
| 43 |
""" |
| 44 |
When I run "xmllint reports/TESTS-special_char.xml" |
| 45 |
Then it should pass |
| 46 |
And the command output should not contain "parser error" |
| 47 |
And the command output should not contain: |
| 48 |
""" |
| 49 |
reports/TESTS-special_char.xml:12: parser error : PCDATA invalid Char value 4 |
| 50 |
""" |
| 51 |
And note that "xmllint reports additional correlated errors" |