Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid XML character in jUnit reports in case of failure #454

Closed
Marcdsv opened this issue Nov 29, 2021 · 2 comments · Fixed by #482
Closed

Invalid XML character in jUnit reports in case of failure #454

Marcdsv opened this issue Nov 29, 2021 · 2 comments · Fixed by #482

Comments

@Marcdsv
Copy link

Marcdsv commented Nov 29, 2021

When exporting an jUnit (XML) report with the following command:
venom run tests.yml --format=xml --output-dir="report"

If there is a failure, the failing <testcases> item contain <failure> items that look like terminal formatted text. They contain an invalid character (Unicode: 0x1b) regarding XML which looks like an ANSI escape character.

See for example:

<testcase classname="tests.yml" name="9HzKUn0B8FoxABqiN1Pw-test-case-calling-XXX-api-endpoint-YYY" time="2.247329012">
    <failure><![CDATA[�[33mTestcase "9HzKUn0B8FoxABqiN1Pw - test case: calling XXX-api endpoint YYY", step #0: Assertion "result.bodyjson.bodyjson36 ShouldEqual Maxwell & Williams" failed. expected: Maxwell & Williams  got: MAXWELL & WILLIAMS (tests.yml:4886)�[0m]]></failure>
    <failure><![CDATA[�[33mTestcase "9HzKUn0B8FoxABqiN1Pw - test case: calling XXX-api endpoint YYY", step #0: Assertion "result.bodyjson.bodyjson37 ShouldEqual MAXWELL & WILLIAMS" failed. expected: MAXWELL & WILLIAMS  got: Maxwell & Williams (tests.yml:4887)�[0m]]></failure>
    <failure><![CDATA[�[33mTestcase "9HzKUn0B8FoxABqiN1Pw - test case: calling XXX-api endpoint YYY", step #0: Assertion "result.bodyjson.bodyjson91 ShouldEqual Schlafgut" failed. expected: Schlafgut  got: schlafgut (tests.yml:4941)�[0m]]></failure>
    <failure><![CDATA[�[33mTestcase "9HzKUn0B8FoxABqiN1Pw - test case: calling XXX-api endpoint YYY", step #0: Assertion "result.bodyjson.bodyjson92 ShouldEqual schlafgut" failed. expected: schlafgut  got: Schlafgut (tests.yml:4942)�[0m]]></failure>
    <system-out></system-out>
    <system-err></system-err>
</testcase>

This issue blocks the integration of this XML report with other tools because the XML file is invalid:

[Fatal Error] test_results.xml:1004:25: An invalid XML character (Unicode: 0x1b) was found in the CDATA section.
Could not parse file report/test_results.xml
@yesnault
Copy link
Member

Hi,

Can you try to run venom with IS_TTY env set, as:
IS_TTY=true venom run ...

@Marcdsv
Copy link
Author

Marcdsv commented Nov 30, 2021

Hello, I tried but the same issue happens.

fsamin added a commit that referenced this issue Dec 28, 2021
and fix the IS_TTY option

closes #454

Signed-off-by: francois  samin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants