Micro Focus QTP (UFT) Forums
How to export the QTP Test results in to HTML file using script - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: How to export the QTP Test results in to HTML file using script (/Thread-How-to-export-the-QTP-Test-results-in-to-HTML-file-using-script)



How to export the QTP Test results in to HTML file using script - venkatbatchu - 08-12-2009

Hi All,
Could you please explain me about the exporting of QTP Test results in to HTML file using script (Not from the File menu)

Thanks,
Venkat.Batchu


RE: How to export the QTP Test results in to HTML file using script - manabh - 08-12-2009

It seems that you are not looking QTP Help thoroughly!!! Tongue
It's an inbuilt feature from QTP, you don't need any script to do this.
The only thing you need to do is set some registry values.
Go to registry key - "HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\Logger\Media\Log"
set the value for "Active" value to 1 (which is 0 by default.)

This will create a parallel result in HTML while your script is running. Along with the normal QTP Result, one Log folder will be created in your result path's Report folder which will contain the HTML report step by step.


RE: How to export the QTP Test results in to HTML file using script - basanth27 - 08-12-2009

Manabh -
This is not exactly true. What you specified above is only a mere html log report and not a detailed execution report. There exist a code where you will need to read the XML values from the results.xml and using the Pdetail.xsl or Pshort.xsl stylesheets you can convert a xml result to a Html result format.


RE: How to export the QTP Test results in to HTML file using script - manabh - 08-12-2009

Basanth,
Have you tried this one out? If not then I request you to please try it out & then quote. I am using this feature quite frequently. As this html file is more easier to transfer, whenever I need to show step-by-step reslts, I can transfer this file.
As you see in regular QTP result in Tree format, this HTML displays the same in columner format. It contains Each & Every Step executed by QTP while executing the script with time flag & it's status (Pass/Fail/Done).


RE: How to export the QTP Test results in to HTML file using script - basanth27 - 08-12-2009

Tried, used, dusted and abandoned. Why dont you try this on your script,

When you sync a object to wait, can you use a while loop for say 30 counters and see the result on the log file ? Morever the display is in a very tabular format and as i specified is not clear to read when you have enormous iterations hapening. If you have been adjusted to it, I am extremely sorry to wake up the monster. However, on a side-line try to read through a xml file and convert it using the XSL stylesheet and find the difference.


RE: How to export the QTP Test results in to HTML file using script - Saket - 08-12-2009

I am fully agree with Manoj, the log report itself is much described as in result viewer. also this helps when the result is incomplete.
although we can do the same as you suggested.

Venkat - may be you can try this as well. hope it will help you.
Code:
sResults = "C:\Results.xml"
sXSL = "C:\Program Files\HP\QuickTest Professional\dat\PDetails.xsl"
createHTML sResults, sXSL, "C:\Results.html"

Public Function createHTML(XMLFile,XSLFile, HTMLFile)
Set xmlDoc = CreateObject("MSXML.DOMDocument" )
Set xslDoc = CreateObject("MSXML.DOMDocument" )
xmlDoc.async = False
xslDoc.async = False
xslDoc.load XSLFile
xmlDoc.load XMLFile
outputText = xmlDoc.transformNode(xslDoc.documentElement)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set outFile = FSO.CreateTextFile(HTMLFile,True)
outFile.Write outputText
outFile.Close
Set outFile = Nothing
Set FSO = Nothing
Set xmlDoc = Nothing
Set xslDoc = Nothing
Set xmlResults = Nothing
End Function

Basanth-what do you mean when you say - "When you sync a object to wait, can you use a while loop for say 30 counters and see the result on the log file ?" does it show up at the result viewer?
also the report generated by xsl is much similar to the log report but with more organised and in readable format.
I think you should not ignore the existing Log report. that also helps in some or other way.


RE: How to export the QTP Test results in to HTML file using script - manabh - 08-12-2009

I have never said that it's a readable, I have said that it contains each & every step to what you have said "This is not exactly true. What you specified above is only a mere html log report and not a detailed execution report.".
Again I have stated that this is much more easier to handle/transfer due to it's size.
"If you have been adjusted to it, I am extremely sorry to wake up the monster.".
For this, It's not the matter of adjustment, It's the matter of using existing features of QTP easily, instead of making a Tool for a Tool.


RE: How to export the QTP Test results in to HTML file using script - basanth27 - 08-12-2009

Absolutely !! The feature cannot be ignored at any sense. This was made available to ensure that you have a quick Html report ready. However when your project size grows and you have huge scripts, this really becomes redundant. My only concern is, when you know that you can do it in a better way, then do it at first.

What i meant with the Sync is - In any applications when you try to use the waitproperty and you give say, 20 secs , the loop actually writes the number of times it iterated until it achieved the property. Imagine a script which may utilize this sync function to a larger extent. Your HTML log report simply becomes cumbersome to read through.


RE: How to export the QTP Test results in to HTML file using script - Saket - 08-12-2009

If I understood this right - you want to say that if I use waitproperty then it writes all the iteration into the results until it reaches the property.
I dont feel it behaves the way you suggested, I have just tried to get that but I am not able to find anything mis-behaved there. let me know if I am wrong some where. Just trying to understand what exactly the case could be.

I any case the log report will give you exact steps which are there in result viewer.


RE: How to export the QTP Test results in to HTML file using script - manabh - 08-12-2009

Yes, this is true, unless you don't report any thing or your statement doesn't include any QTP action statements (i.e. "Exists", "Set", "Get", "Sync"), QTP won't report these statements in report. If you loop for 30 iterations without any QTP action statements in it, you can't get anything from results that you have iterated for n number of times.