Skip to content

Colon in junit assertion message causes incorrect xml parsing #931

Description

@mrodkiewicz

Hello,

Colon (:) in assert message incorrectly splits generated message.

Example for nodejs/intellij below:

client.assert(false, "This is colon here:and this after colon");

Junit XML output snippet:

<properties>
        <property name="displayMessage" value="AssertionError [ERR_ASSERTION]: This is colon here: and this after colon - vo.assert (/node_modules/httpyac/dist/index.js:3:54449"/>
        <property name="file" value="vo.assert (/node_modules/httpyac/dist/index.js"/>
        <property name="line" value="3"/>
        <property name="offset" value="54449"/>
        <property name="errorType" value="AssertionError [ERR_ASSERTION]: This is colon here"/>
        <property name="message" value="and this after colon"/>
      </properties>
      <failure message="Security settings exist" type="AssertionError [ERR_ASSERTION]: This is colon here">{"message":"This is colon here:and this after colon","name":"AssertionError","stack":"AssertionError [ERR_ASSERTION]: This is colon here:and this after colon\n    at vo.assert (/node_modules/httpyac/dist/index.js:3:54449)\n    at /projects/enforcement-service-tests/test-verify.http:10:16\n    at r (/node_modules/httpyac/dist/index.js:2:21681)\n    at vo.test (/node_modules/httpyac/dist/index.js:3:54422)\n    at Object.userJS (/projects/enforcement-service-tests/test-verify.http:7:12)\n    at Object.cr [as runScript] (/node_modules/httpyac/dist/index.js:119:2730)\n    at Mo.executeScriptData (/node_modules/httpyac/dist/index.js:116:22371)\n    at Mo.processOnResponse (/node_modules/httpyac/dist/index.js:116:22287)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async o.trigger (/node_modules/hookpoint/dist/index.js:1:2872)"}</failure>

Expected with semi-colon instead of colon example:

client.assert(false, "This is colon here;and this after colon");
<properties>
        <property name="displayMessage" value="AssertionError [ERR_ASSERTION]: This is colon here;and this after colon - vo.assert (/node_modules/httpyac/dist/index.js:3:54449"/>
        <property name="file" value="vo.assert (/node_modules/httpyac/dist/index.js"/>
        <property name="line" value="3"/>
        <property name="offset" value="54449"/>
        <property name="errorType" value="AssertionError [ERR_ASSERTION]"/>
        <property name="message" value="This is colon here;and this after colon"/>
      </properties>
      <failure message="Security settings exist" type="AssertionError [ERR_ASSERTION]">{"message":"This is colon here;and this after colon","name":"AssertionError","stack":"AssertionError [ERR_ASSERTION]: This is colon here;and this after colon\n    at vo.assert (/node_modules/httpyac/dist/index.js:3:54449)\n    at /projects/enforcement-service-tests/test-verify.http:10:16\n    at r (/node_modules/httpyac/dist/index.js:2:21681)\n    at vo.test (/node_modules/httpyac/dist/index.js:3:54422)\n    at Object.userJS (/projects/enforcement-service-tests/test-verify.http:7:12)\n    at Object.cr [as runScript] (/node_modules/httpyac/dist/index.js:119:2730)\n    at Mo.executeScriptData (/node_modules/httpyac/dist/index.js:116:22371)\n    at Mo.processOnResponse (/node_modules/httpyac/dist/index.js:116:22287)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async o.trigger (/node_modules/hookpoint/dist/index.js:1:2872)"}</failure>

This is painful especially with used URL in assert messages.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions