We recently upgraded to ALM 11 at work and I am trying to add some formatting to the run details field in the HP Run Results Viewer application. We have existing code from older versions of ALM that displays the info on multiple lines:
pass =
fail =
warning =
The code we used was like this:
Stats = "Passed = " & vbCrLf & "Failed = " & vbCrLf & "Warning = "
Reporter.ReportEvent micFail, "Test", stats
In ALM 11's viewer it shows up as pass= fail= warning=
all on one line.
Is there a way to add the new line to the results? This is our most simple example and much of the results are currently unreadable.
Unfortunately, I do not have any good explanation for why your code doesn't work. It looks OK to me. However, I have an alternative approach that might do the trick: Have you tried to use ASCII and Unicode Character Codes instead of the VBScript built-in "vbCrLf"?
Using the ASCII approach, your code would look like this:
Stats = "Passed = " & Chr(10) & "Failed = " & Chr(10) & "Warning = "
Chr(10) equals an NL line feed, i.e. a new line. Chr(13) would do a carriage return, if you want to try that instead, or in addition to, the line feed.
More information on the Chr function can be found here: https://msdn.microsoft.com/en-us/library/ws6aa3sf(v=vs.84).aspx.
UPDATE: It looks like this is a known defect in QTP 11 - see http://h30499.www3.hp.com/t5/Unified-Functional-Testing/QTP-run-result-viewer-issue-with-VBCRLF/td-p/5898077.
There is another approach you could try (unless upgrading QTP is an option), using HTML and LogEvent - see http://www.joecolantonio.com/2014/11/06/revealed-four-secret-functions-hidden-in-qtp-and-uft/, but beware of the limitations mentioned in the comments section.