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


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


      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"?>
      	<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">
      					<message>OK: TestProcess.Execution.ExitCode == 0&#xD;
      FAIL: Output differs from reference.&#xD;
        Left:  data\ref&#xD;
        Right: results\out&#xD;

      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.




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


              • Created: