Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-52908

Newlines get ignored in failure message and possibly stack trace when uploading xUnitDotNet xml results

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: xunit-plugin
    • Labels:
      None
    • Environment:
      Windows Server 2008
      Jenkins 2.128
      XUnit 2.0.3
    • Similar Issues:

      Description

      We upload test results using Jenkinsfile like this:

      xunit testTimeMargin: '3000', thresholdMode: 1, thresholds: [failed(), skipped()], tools: [xUnitDotNet(deleteOutputFiles: true, failIfNotNew: false, pattern: 'tests\\results\\results.xml', skipNoTestFiles: false, stopProcessingIfError: true)]

      This is the content of the results.xml:

      <?xml version="1.0" encoding="utf-8"?>
      <assemblies>
      	<assembly name="Test.exe" environment="OS: Microsoft Windows NT 6.2.9200.0" run-date="2018-38-06" run-time="02:38:04" test-framework="Test Framework 0.1" total="1" passed="0" failed="1" skipped="0" errors="0">
      		<collection name="collection1" time="36.7820544" total="1" passed="0" failed="1" skipped="0">
      			<test name="collection1\test.xml" type="" method="" time="36.7820544" result="Fail">
      				<failure>
      					<message>OK: TestProcess.Execution.ExitCode == 0&#xD;
      FAIL: Output differs from reference.&#xD;
        Left:  data\ref&#xD;
        Right: results\out&#xD;
        &#xD;
                          </message>
      				</failure>
      			</test>
      		</collection>
      	</assembly>
      </assemblies>

      The failure messages can be quite large for us and the newlines getting ignored makes them basically useless, thus I set this to Major priority.

      Things I've tried so far:

      1. Enable newline escaping (we use our own framework to generate this XML in C#; note that in C# only CR gets escaped unless resorting to manual voodoo. This shouldn't be required, as LF is a valid character that should be preserved when loading by XML spec: https://www.w3.org/TR/2004/REC-xml11-20040204/#sec-line-ends ).
      2. Using only CR or only LF.
      3. Replacing newline characters with HTML <br>, <br/> tags (this probably can't work, as the text is displayed in a <pre> tag)
      4. Putting the message in a CDATA block and all of the above but within CDATA.

      Newlines should be easier than that.

        Attachments

          Activity

          gl1koz3 Edgars Batna created issue -
          gl1koz3 Edgars Batna made changes -
          Field Original Value New Value
          Environment Windows Server 2008 Windows Server 2008
          Jenkins 2.128
          XUnit 2.0.3
          gl1koz3 Edgars Batna made changes -
          Summary Newlines get ignored in failure message and stack trace when uploading xUnitDotNet xml results Newlines get ignored in failure message and possibly stack trace when uploading xUnitDotNet xml results
          gl1koz3 Edgars Batna made changes -
          Description We upload test results using Jenkinsfile like this:
          {code:java}
          xunit testTimeMargin: '3000', thresholdMode: 1, thresholds: [failed(), skipped()], tools: [xUnitDotNet(deleteOutputFiles: true, failIfNotNew: false, pattern: 'tests\\results\\results.xml', skipNoTestFiles: false, stopProcessingIfError: true)]{code}
          This is the content of the results.xml:
          {code:java}
          <?xml version="1.0" encoding="utf-8"?>
          <assemblies>
          <assembly name="Test.exe" environment="OS: Microsoft Windows NT 6.2.9200.0" run-date="2018-38-06" run-time="02:38:04" test-framework="Test Framework 0.1" total="1" passed="0" failed="1" skipped="0" errors="0">
          <collection name="collection1" time="36.7820544" total="1" passed="0" failed="1" skipped="0">
          <test name="collection1\test.xml" type="" method="" time="36.7820544" result="Fail">
          <failure>
          <message>OK: TestProcess.Execution.ExitCode == 0&#xD;
          FAIL: Output differs from reference.&#xD;
            Left: data\ref&#xD;
            Right: results\out&#xD;
            &#xD;
                              </message>
          </failure>
          </test>
          </collection>
          </assembly>
          </assemblies>{code}
          The failure messages can be quite large for us and the newlines getting ignored makes them basically useless, thus I set this to Major priority.

          Things I've tried so far:
           # Enable newline escaping (we use our own framework to generate this XML in C#; note that in C# only CR gets escaped unless resorting to manual voodoo. This shouldn't be required, as LF is a valid character that should be preserved when loading by XML spec: [https://www.w3.org/TR/2004/REC-xml11-20040204/#sec-line-ends] ).
           # Using only CR or only LF.
           # Replacing newline characters with HTML tags (this probably can't work, as the text is displayed in a <pre> tag)
           # Putting the message in a CDATA block and all of the above but within CDATA.

          Newlines should be easier than that.
          We upload test results using Jenkinsfile like this:
          {code:java}
          xunit testTimeMargin: '3000', thresholdMode: 1, thresholds: [failed(), skipped()], tools: [xUnitDotNet(deleteOutputFiles: true, failIfNotNew: false, pattern: 'tests\\results\\results.xml', skipNoTestFiles: false, stopProcessingIfError: true)]{code}
          This is the content of the results.xml:
          {code:java}
          <?xml version="1.0" encoding="utf-8"?>
          <assemblies>
          <assembly name="Test.exe" environment="OS: Microsoft Windows NT 6.2.9200.0" run-date="2018-38-06" run-time="02:38:04" test-framework="Test Framework 0.1" total="1" passed="0" failed="1" skipped="0" errors="0">
          <collection name="collection1" time="36.7820544" total="1" passed="0" failed="1" skipped="0">
          <test name="collection1\test.xml" type="" method="" time="36.7820544" result="Fail">
          <failure>
          <message>OK: TestProcess.Execution.ExitCode == 0&#xD;
          FAIL: Output differs from reference.&#xD;
            Left: data\ref&#xD;
            Right: results\out&#xD;
            &#xD;
                              </message>
          </failure>
          </test>
          </collection>
          </assembly>
          </assemblies>{code}
          The failure messages can be quite large for us and the newlines getting ignored makes them basically useless, thus I set this to Major priority.

          Things I've tried so far:
           # Enable newline escaping (we use our own framework to generate this XML in C#; note that in C# only CR gets escaped unless resorting to manual voodoo. This shouldn't be required, as LF is a valid character that should be preserved when loading by XML spec: [https://www.w3.org/TR/2004/REC-xml11-20040204/#sec-line-ends] ).
           # Using only CR or only LF.
           # Replacing newline characters with HTML <br>, <br/> tags (this probably can't work, as the text is displayed in a <pre> tag)
           # Putting the message in a CDATA block and all of the above but within CDATA.

          Newlines should be easier than that.
          shanexpert28 shan shan made changes -
          Assignee Nikolas Falco [ nfalco ] shan shan [ shanexpert28 ]
          shanexpert28 shan shan made changes -
          Assignee shan shan [ shanexpert28 ] Nikolas Falco [ nfalco ]
          shanexpert28 shan shan made changes -
          Assignee Nikolas Falco [ nfalco ]
          nfalco Nikolas Falco made changes -
          Assignee Nikolas Falco [ nfalco ]
          nfalco Nikolas Falco made changes -
          Priority Major [ 3 ] Minor [ 4 ]
          nfalco Nikolas Falco made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              nfalco Nikolas Falco
              Reporter:
              gl1koz3 Edgars Batna
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: