Mahi_v
Member
Reged: 02/06/07
Posts: 61
|
|
hi, How to Export test results to HTML file in QTP? pls send the script or give some idea.
Thanks in advance, Mahi.
|
TmReddy
Advanced Member
Reged: 02/01/07
Posts: 456
Loc: Pittsburgh, USA
|
|
File->ExportTo HTML File(from the results window)
|
Mahi_v
Member
Reged: 02/06/07
Posts: 61
|
|
I know that. I am asking, using Script how we do automatically. or any settings is there to do automatically.
|
RKY
stranger
Reged: 08/22/06
Posts: 586
Loc: Bangalore, India
|
|
Check the below Link and find the code
Page Link
In the code you need to provide the XSL file name. In QTP you will find 3 XSL files. find the XSL file under the QTP installation folder \ dat \ <Here>. File starts with PDetails for Detailed report and PShort for short report, Update the appropriate XSL in the code, and last specify the Html output filename and location.
I hope this will help for you,
--------------------
Hope this helps you,
- RKY
|
RKY
stranger
Reged: 08/22/06
Posts: 586
Loc: Bangalore, India
|
|
Before that Keep in mind you need to call this function once QTP done with execution, then only Results.xml file will generate until that file Results.xml wont generate
--------------------
Hope this helps you,
- RKY
|
Mahi_v
Member
Reged: 02/06/07
Posts: 61
|
|
I didn't find QTP installation folder. where it is located.
I am using frame work for testing SAP modules. After running all the scripts , the test results window will come. i want to convert that test results window as a HTML file and export to report folder.
|
RKY
stranger
Reged: 08/22/06
Posts: 586
Loc: Bangalore, India
|
|
Mahi
what i exactly referring as Go to QTP installation folder under that go to Dat foldet ,there you could find the as above said XSL files.
I hope this will make more sense
--------------------
Hope this helps you,
- RKY
|
Mahi_v
Member
Reged: 02/06/07
Posts: 61
|
|
Thank u buddy. i Found PDetails.xls file. that file contains the following code. here what i need to change , to get the html report automatically and store it in the results folder
[Tarun] -> No need to paste such a large XML when everyone having QTP will be able to get the XML.
Edited by Tarun Lalwani (05/08/07 11:46 PM)
|
Jits
Advanced Member
Reged: 01/31/07
Posts: 492
Loc: Pune, India
|
|
You can attach as file rather then copying here!!
|
Dipika
Member
Reged: 01/02/07
Posts: 261
Loc: Central India
|
|
I tried with this but ,when I opened it with Browser(IE),it just displayed
Report Test:
That's all.
Please tell me how to do this task. Dipika
|
RKY
stranger
Reged: 08/22/06
Posts: 586
Loc: Bangalore, India
|
|
Dipika
Look into the all posts in the thread which is said above and copy the Vb script code from the link which is specified and replace the appropriate XSL file and execute you will get the HTML report.
--------------------
Hope this helps you,
- RKY
|
Dipika
Member
Reged: 01/02/07
Posts: 261
Loc: Central India
|
|
I save the results by exporting it to the HTML File.After going through your response,I opened it in the notepad.This is what is displayed ------------------------------------------------------------------ <html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-16"> <title Localizable_1="True"> Report</title> <link rel="stylesheet" type="text/css" href="PResults.css"> </head> <body bgcolor="#ffffff" leftmargin="0" marginwidth="20" topmargin="10" marginheight="10" vlink="#9966cc"> <center> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="hl_qt"> <div align="center"><span class="hl_qt" Localizable_1="True">Report</span></div> </td> </tr> <tr> <td class="hl0"> <p><span class="hl0_name" Localizable="True">Test:</span><span class="hl0"></span></p> </td> </tr> </table><br></center> </body> </html> --------------------------------------------------- I copied the entire code and pasted in this file .when I refresh it It gives me this thing.It gives me error on the page.may be I have not got wat u were trying to say or may be i have done things in a wrong manner,Plz help me out
|
RKY
stranger
Reged: 08/22/06
Posts: 586
Loc: Bangalore, India
|
|
Dipika
You have to Update the Corrosponding XSL file as ...\PDEtails.XSL in the Code which is available in the supplied as Link ,Supply the XML file as your result ...\Results.XMl and Target file as "C:\Test.html" you will get the HTML file
I hope this will more sense for you
--------------------
Hope this helps you,
- RKY
|
miraz2007
Newbie
Reged: 05/07/07
Posts: 23
|
|
Could anyone provide detail step's for this.
Thanks Narendra singh
|
RKY
stranger
Reged: 08/22/06
Posts: 586
Loc: Bangalore, India
|
|
Narendra singh
Here it is explained more than that you are expecting. Look into that thread from the beginning.
I hope this will help for you
--------------------
Hope this helps you,
- RKY
|
miraz2007
Newbie
Reged: 05/07/07
Posts: 23
|
|
Ram
I got that XSL file but just i want to know that, what i need to change into that XSL files and how can get the html report automatically after the test execution.
Do i need to writ a code for that.Please provide details regarding this.
Thanks Narendra
|
Dipika
Member
Reged: 01/02/07
Posts: 261
Loc: Central India
|
|
Dear Jeff,
If u don't mind,could u be more descriptive ,Bcoz I am not able to do it.It will be very generous on yr part if u help me out in doing this task
|
RKY
stranger
Reged: 08/22/06
Posts: 586
Loc: Bangalore, India
|
|
Dipika
I have attached the code. look into that code line by line. Update appropriate input value as per your settings and run the code
I hope this will make more sense for you
--------------------
Hope this helps you,
- RKY
Edited by Jeff_Hardy (05/13/07 09:47 PM)
|
Dipika
Member
Reged: 01/02/07
Posts: 261
Loc: Central India
|
|
Dear Jeff, I think Its the same code with which I have been trying uptill now.U have to tell me where(in which file) I have to keep this code ,so that I get the desired Response
|
RKY
stranger
Reged: 08/22/06
Posts: 586
Loc: Bangalore, India
|
|
Copy the entire code and paste into QTP Editor and run it(with updated values)
--------------------
Hope this helps you,
- RKY
|
Dipika
Member
Reged: 01/02/07
Posts: 261
Loc: Central India
|
|
I tried as u said I got this error --------------------- The style sheet does not contain a document element. The style sheet may be empty, or it may not be a well-formed XML document. ----------------------- now what to do?
|
RKY
stranger
Reged: 08/22/06
Posts: 586
Loc: Bangalore, India
|
|
attach the Pdetails.XSL file in the forum.
--------------------
Hope this helps you,
- RKY
|
Dipika
Member
Reged: 01/02/07
Posts: 261
Loc: Central India
|
|
I am sending u the Pdetails.xsl file but unable to understand as to where the changes have to be made.Could u plz guide me with this.
|
RKY
stranger
Reged: 08/22/06
Posts: 586
Loc: Bangalore, India
|
|
Attach PDetails.XSL file ,It shows the Html page
--------------------
Hope this helps you,
- RKY
|
Dipika
Member
Reged: 01/02/07
Posts: 261
Loc: Central India
|
|
I did try to attach that Pdetails.xls file But Then it said that it won't attach this file so I copied the contents and pasted it on the notepad and sent it to u It wud be very kind if u tell me step by step how things have to be done to do that task. Sorry for the Troubling u so much but I am very keen in doing this work
|
Tarun Lalwani
Veteran
Reged: 07/21/05
Posts: 13526
|
|
Just to make things clear. You can't convert a Result XML from QTP in case it is for the script which is currently running. You need to either do it through a VBS file or for a script which has already finished.
-------------------- Regards,
Tarun
QTP Interview Unplugged - Experience a real Interview...
KnowledgeInbox RSS
|
Dipika
Member
Reged: 01/02/07
Posts: 261
Loc: Central India
|
|
Yes , but I am unable to understand how to work out the things.
|
miraz2007
Newbie
Reged: 05/07/07
Posts: 23
|
|
Dear Jeff,
Attached PDetails.XSL file. Could you please tell me that what exactly I need to make change on it.
Thanks Narendra
|
Dipika
Member
Reged: 01/02/07
Posts: 261
Loc: Central India
|
|
Yes Jeff,
Please tell me also as to how to Proceed in this case
|
Dipika
Member
Reged: 01/02/07
Posts: 261
Loc: Central India
|
|
Sorry,I don't ahve much knowledge about QTP,But He asked for the PDetails file and Not the rEsult XML File Tarun.I hope I am not very Wrong.and I didn't find any PDetails.xls file in the Result Folder.
|
rss
Member
Reged: 04/19/07
Posts: 57
|
|
Anyone getting the test results as HTML file.
I tried as per Hardy comments, updated the xmlSource.Load and xmlXForm.Load, its creating the html file as TestReport.html in "C:\" directory. After executed any script and opened that html file contains only
Report Test:
Attached the PDetails.xsl with this post. Please open the attachment in Wordpad or Textpad, while attaching the file its not accepting the xsl file so converted as .doc and let us know where we need to modify...
Edited by rss (05/21/07 12:51 AM)
|
Dipika
Member
Reged: 01/02/07
Posts: 261
Loc: Central India
|
|
Its amazing that people do know how to srt out someone's Problem but after giving few Tips refrain themselves from Giving Complete Solutions.
|
Tarun Lalwani
Veteran
Reged: 07/21/05
Posts: 13526
|
|
Well! Have your ever thought why does this happens to your posts only?
Here is your last one which went too long then expected http://www.sqaforums.com/showflat.php?Cat=0&Board=UBB20&Number=365912
What i personally feel is that you dont give others a very good chance to support for long. You need to improve on your researching skills for solving the problems and then only will others be able to help. If you want an answer to your query then post what exactly you want to do and what you have understood till now and where does the problem lie. I can answer you but not till i see what have you tried to understand.
-------------------- Regards,
Tarun
QTP Interview Unplugged - Experience a real Interview...
KnowledgeInbox RSS
|
Shipto
Junior Member
Reged: 07/24/06
Posts: 18
Loc: ZHA
|
|
Thanks Jeff.
It works.
|
Dipika
Member
Reged: 01/02/07
Posts: 261
Loc: Central India
|
|
I am very Sorry to say Tarun,although that particular Post went too long but Then also I didn't get a proper Reply.And at last I tried on my Own and I got It! Now Its not the case with my posts only but thee are in deed many other post which go so long without getting Proper response.So Please Its my request that don't Point Out Like this and In this manner.Its not only me who has been waiting for the response of this query But as you go thru the Thread ,You will find many other People in the queue.Right .Please Go thru the thread. Thanks for your Kind Concern But rather than pointing out Like this.It would have been better if U would have written last line only so I would have explained you the entire Scenario.Well May be I am not very clear ,I just read this and started Trying.I never did researching on it. Sorry for this attempt.
|
Perf_Learner
Member
Reged: 03/02/07
Posts: 262
Loc: Mumbai, India
|
|
Hi Tarun,
I think this issue could better be resolved if you give a complete answer. EVen I am facing this problem from long but refrained from posting the quey as it has been posted quite often. But none has the proper result. So I would please request yu to post the answer to this question as to how can we save a test result into HTML file.
Regards Ankush
-------------------- Regards,
Performance Learner
|
Tarun Lalwani
Veteran
Reged: 07/21/05
Posts: 13526
|
|
Dipika, It's was not just about you. We have been trying to help everyone on the forum but the only thing that i see less is that people dont say what they have understood and what they are missing. "It's not working" is not really a good response that we expect to see...Anways lets come down to business
I will try to keep it short and simple.
QTP generate it's results in XML format. These results are only accessible when the test case has finished execution. Any manipulation that you want to do with the results you can do that only outside of QTP (in case you are looking at the results of QTP script that just ran). This can be achieved by running you script from a external VBS which use QTP AOM for running the script. And once done you can access the script in the external VBS.
Coverting results to HTML: XSL is a Stylesheet language which can be used to transform a XML in way we want it to be. The output could be a HTML file, a text file, a XML file etc...To do this transformation at run-time we need to load the XML and then the XSL into that and save the output. QTP comes with three different XSL files which are present in the below location
C:\Program Files\Mercury Interactive\QuickTest Professional\dat PDetails.xsl - Detalied HTML Conversion PShort.xsl - Short HTML conversion PSelection.xsl - Selective HTML Conversion
The last one (PSelection.xsl) requires input arguments for the XSL and the first 2 can be simply loaded into the XML.
Code:
sResultsXML = "C:\Results.xml" sDetailedXSL = "C:\Program Files\Mercury Interactive\QuickTest Professional\dat\PDetails.xsl" sShortXSL = "C:\Program Files\Mercury Interactive\QuickTest Professional\dat\PDetails.xsl"
ApplyXSL sResultsXML, sDetailedXSL, "C:\Results_Detailed.html" ApplyXSL sResultsXML, sShortXSL, "C:\Results_Short.html"
Public Function ApplyXSL(ByVal inputXML, ByVal inputXSL, ByVal outputFile) sXMLLib = "MSXML.DOMDocument" Set xmlDoc = CreateObject(sXMLLib) Set xslDoc = CreateObject(sXMLLib) xmlDoc.async = False xslDoc.async = False xslDoc.load inputXSL xmlDoc.load inputXML outputText = xmlDoc.transformNode(xslDoc.documentElement)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set outFile = FSO.CreateTextFile(outputFile,True) outFile.Write outputText outFile.Close
Set outFile = Nothing Set FSO = Nothing Set xmlDoc = Nothing Set xslDoc = Nothing Set xmlResults = Nothing End Function
I have attached the outputs to the post. Just note one thing that in case you want the results to be displayed correctly then the PResults.css file should be present in the same folder as HTML.
-------------------- Regards,
Tarun
QTP Interview Unplugged - Experience a real Interview...
KnowledgeInbox RSS
|
miraz2007
Newbie
Reged: 05/07/07
Posts: 23
|
|
Thanks Tarun,
It is working fine.
Thanks Mir
Edited by miraz2007 (05/23/07 01:03 PM)
|
Dipika
Member
Reged: 01/02/07
Posts: 261
Loc: Central India
|
|
Thanks Jerry and Tarun
I have done it.
|
SSKQA
Member
Reged: 07/27/07
Posts: 37
|
|
Hi All
I am facing the same problem, I need to export the results to html.
What I Did
1. USed the above code (provided by Tarun) in a script and also moved the PResults.css into the same Folder where I am Destinating the Result HTML Files. 2. Executed the Script in which I had appended the html reporting Script given above.
Problem : I Could see that the Results_Detailed.html files created has only Report and Test sections without any result data, the page is blank.
Did I miss any process or Am I in the incorrect approach, Please provide some inputs on this.
Santhosh
-------------------- Santhosh
|
TmReddy
Advanced Member
Reged: 02/01/07
Posts: 456
Loc: Pittsburgh, USA
|
|
Are you pointing to right Results.xml file in your code?
|
Tarun Lalwani
Veteran
Reged: 07/21/05
Posts: 13526
|
|
I think you missed a critical part
Quote:
These results are only accessible when the test case has finished execution. Any manipulation that you want to do with the results you can do that only outside of QTP (in case you are looking at the results of QTP script that just ran). This can be achieved by running you script from a external VBS which use QTP AOM for running the script. And once done you can access the script in the external VBS.
-------------------- Regards,
Tarun
QTP Interview Unplugged - Experience a real Interview...
KnowledgeInbox RSS
|
SSKQA
Member
Reged: 07/27/07
Posts: 37
|
|
Hi Again !
I had missed the loading of xml file earlier, but loaded the xml file from one of the script's Report folder now , which converted the existing Report into html format, But how do I Make this for a run time script, i.e I need to see the results in html for the script I execute now.
Santhosh
-------------------- Santhosh
|
jayashreenitekar
Newbie
Reged: 08/03/07
Posts: 4
|
|
Hi Tarun Thank you very much for the code given by you. It was really a great help for me. I have used this code to convert XML to excel conversion. It works fine but if the XML file size exceed to 13MB or above the following error message is displayed. "There is not enough space on the disk". How to resolve this issue? Please help.
Is there any method to convert the XML to CSV file(or any kind of Spread sheets)
Thank you. Jayashree
|
Tarun Lalwani
Veteran
Reged: 07/21/05
Posts: 13526
|
|
Try using the latest XML parser. This one is a pretty old version i guess. So you need to change MSXML.DOMDocument to the latest version Class ID.
-------------------- Regards,
Tarun
QTP Interview Unplugged - Experience a real Interview...
KnowledgeInbox RSS
|
jayashreenitekar
Newbie
Reged: 08/03/07
Posts: 4
|
|
Hi Tarun, I am using the MSXML2.DOMDocument instead of MSXML.DOMDocument. I am not sure whether i have used the correct one. But still i am getting the same errors. I get either of the error messages if my xml file exceed more than 13mb. 1. There is not enough space on the disk 2. Insufficient system resources exist to complete the requested service. Code is as below:
sResultsXML = "C:\Documents and Settings\L014540\Local Settings\Temp\TempResults\Report\Results.xml" sDetailedXSL = "C:\Program Files\QuickTest Professional\dat\PDetails.xsl" sShortXSL = "C:\Program Files\QuickTest Professional\dat\Pshort.xsl" sSelectionXSL = "C:\Program Files\QuickTest Professional\dat\PSelection.xsl"
ApplyXSL sResultsXML, sDetailedXSL, "X:\PR\Testing\Testpack\ATPFramework\PRATPs\ResultsLog\Results_Detailed.xls"
ApplyXSL sResultsXML, sShortXSL, "X:\PR\Testing\Testpack\ATPFramework\PRATPs\ResultsLog\Results_Short.xls"
ApplyXSL sResultsXML, sSelectionXSL, "X:\PR\Testing\Testpack\ATPFramework\PRATPs\ResultsLog\Results_Selection.xls"
Public Function ApplyXSL(ByVal inputXML, ByVal inputXSL, ByVal outputFile) sXMLLib = "MSXML2.DOMDocument" Set xmlDoc = CreateObject(sXMLLib) Set xslDoc = CreateObject(sXMLLib) xmlDoc.async = False xslDoc.async = False xslDoc.load inputXSL xmlDoc.load inputXML outputText = xmlDoc.transformNode(xslDoc.documentElement) Set FSO = CreateObject("Scripting.FileSystemObject") Set outFile = FSO.CreateTextFile(outputFile,True) outFile.Write outputText outFile.Close Set outFile = Nothing Set FSO = Nothing Set xmlDoc = Nothing Set xslDoc = Nothing Set xmlResults = Nothing End Function
Thank you, Jayashree
|
jayashreenitekar
Newbie
Reged: 08/03/07
Posts: 4
|
|
Hi Tarun, When i am using the above code to convert xml to excel, it gives the all the Status(Done,Passed, Fail,Warnings). Is it possible to eliminate the Done status and get only the Passed and Failed status results?
Thx. Jay
|
Eragon
Newbie
Reged: 01/10/07
Posts: 19
Loc: UK
|
|
Hello Tarun,
Thanks for your help........ can you let me know the input parameters what we need to pass to selection.xsl are they the keywords described in the XSL or anything else. I mean AIter, Tname,sname etc.... Can you please tell me how to pass these selection parameters to the XSL
Thanks in advance,
|
Tarun Lalwani
Veteran
Reged: 07/21/05
Posts: 13526
|
|
Look at below link and you will know how to do it
http://msdn2.microsoft.com/en-us/library/ms950787.aspx
-------------------- Regards,
Tarun
QTP Interview Unplugged - Experience a real Interview...
KnowledgeInbox RSS
|
praveen228
Junior Member
Reged: 09/30/04
Posts: 9
Loc: Pune
|
|
hi, i'm not sure if you've come across this: http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1222546
-------------------- Praveen
|
gyana007
Newbie
Reged: 07/28/08
Posts: 5
|
|
I am not able to produce result with this code,..Pls guide me step by step process so that I can prduce report .html format.
waiting for ur valuable reply..
thanks Gyan
|
Tarun Lalwani
Veteran
Reged: 07/21/05
Posts: 13526
|
|
Are you running the code in your QTP script?
-------------------- Regards,
Tarun
QTP Interview Unplugged - Experience a real Interview...
KnowledgeInbox RSS
|
Sandeep_Khairwal
Newbie
Reged: 07/29/08
Posts: 15
|
|
Hi Jay,
Have you got your queries answer.If yes pls share it with me.If no, Varun pls guide,Is it possible to eliminate the Done status and Smart Identification Alternative Description, and get only the Passed and Failed status results?
Thanks in advance.
Sandeep
|
czar
Member
Reged: 05/25/07
Posts: 90
|
|
Hi everybody,
This is very nice thread. I learned a lot. Thanks for that.I am having a similar problem. I am executing my QTP scripts from QC. Now we have a requirement to send an email automatically with the test results once the execution is done. we want the test results of each test in the test set to be emailed.
Any inputs would be appreciated.
Thanks
-------------------- - Czar
|
gyana007
Newbie
Reged: 07/28/08
Posts: 5
|
|
Thanks for ur reponse..Yes Tarun..I am using this in the script.
My automatiom frame work is like..we have one module in which 7 to 8 pages navigation.. so in main module i call the resuable action(steps) to execute one module.so i need the result in .html and .xls format at the end of the my execution.
Pls guide me..Thanks again.
Thnks Gyan
|
Sandeep_Khairwal
Newbie
Reged: 07/29/08
Posts: 15
|
|
Hi Varun,
First thanks for sharing you knowledge.I got the results in HTML format but i got the Done status statements and Smart Identification Alternative Description also in the results,I need only Pass and Failed status in results.Pls advice how can get it.
Thanks in advance.
Sandeep
|
Tarun Lalwani
Veteran
Reged: 07/21/05
Posts: 13526
|
|
As of now not possible to set such a filter. But this would be possible soon...
-------------------- Regards,
Tarun
QTP Interview Unplugged - Experience a real Interview...
KnowledgeInbox RSS
|
Sandeep_Khairwal
Newbie
Reged: 07/29/08
Posts: 15
|
|
Hi Tarun,
Thanks for quick responce.Fine we will wait for your responce on this filtering. But right now we have to provide the test results to client. If we share these test reports, with Done status statements and Smart Identification Alternative Description statements then its very confusing to them.Is there any alternate way to provide simple test reports to client.
Thanks Sandeep
|
snparikh
Active Member
Reged: 02/05/08
Posts: 877
Loc: Santa Monica, CA, USA
|
|
You can modify the xsl file that you use to export to display only Pass & Fail or the way you want.
-------------------- -Suchit
http://www.foxaudiencenetwork.com/
|
gyana007
Newbie
Reged: 07/28/08
Posts: 5
|
|
Hi Dipika; Can u tell me exact way ..how u did it?how i execute this script in QTP. waiting for ur valuable reponse.
Tnka Gyan
|
Tarun Lalwani
Veteran
Reged: 07/21/05
Posts: 13526
|
|
You need to run the code outside QTP and not inside QTP. Use a external VBScript to run your test and access the result xml
-------------------- Regards,
Tarun
QTP Interview Unplugged - Experience a real Interview...
KnowledgeInbox RSS
|
saif24
Newbie
Reged: 05/28/07
Posts: 15
|
|
HI Jayashree ,
How r u . could you please tell me why the below code does not works for me . I have used the below code as it its excepts the path in the sResultsXML and path for ByVal outputFile. I have used as a vbs file and attached the same to my script .It creates a html report but the report is empty . please help me in this issue .I have also included the .css file in the folder where this html reports are stored.
Thanks Saif
Edited by saif24 (08/16/08 01:37 PM)
|
Tarun Lalwani
Veteran
Reged: 07/21/05
Posts: 13526
|
|
This thread should now be used for reference only.
Thread locked!
-------------------- Regards,
Tarun
QTP Interview Unplugged - Experience a real Interview...
KnowledgeInbox RSS
|