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
 FAIL: Output differs from reference.
 Left: data\ref
 Right: results\out
 
 </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:
- 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.
Glad it's fixed so quickly.
Though, test result formatting is not purely cosmetic. If you can't read them, you can't fix them. I'm not talking exception messages, but formatted tables with a thousand lines and over 10 columns. Thanks for looking into this in any case!