Quality Testing

Quality is delighting customers

Is it posible to generate report in HTML / PDF format using QTP Tool?

In my project, we want to store results set in HTML (or) PDF formats. How to do using QTP?

Is it posible to generate report in HTML / PDF format using QTP Tool?


Views: 5816

Reply to This

Replies to This Discussion

All Blog PostsMy BlogAdd a Blog Post QTP Automation with Adobe PDF Documents
Posted by Anunay Kumar on January 27, 2010 at 1:53am
View Anunay Kumar's blog
Prerequisites -

Full version installation of Adobe Acrobat

This is a mandatory requirement. You need to have a full version of the software installed on your system in order to have access to the Adobe API. The API only gets installed on the system with a full version of Adobe Acrobat software. If you just have adobe reader installed in your system, you cannot get the access to the Adobe API.

OLE Automation Document Object Model

For more detailed info please visit http://learnqtp.info
Tags: advanced, automation, concepts, programming, qtp, scripts, tutorial, with

Share Twitter Facebook

You need to be a member of Test Republic to add comments!
By Default QTP 10.0 Supports "Exporting" the test results in HTML,PDF and DOC formats. however if your question is create a custom report of you own the you would need to write your own custom routines.
Some of the approaches that can be suggested.

1. Store the result initially in txt or csv format and only when the execution is over call HTML parser that you have written to convert the text to HTML tags.
2.Create a XML file while execution is on. Create a XSL file. Open xml file with applied XSL would render a HTML like o/p
3.QTP uses FREngine to transofrm PDFs. So one could get a ABBY FR Engine too

You can create HTML report. Bellow is the code... have fun.



sTime = Replace(Time,"AM","")

sTime = Replace(sTime,"PM","")

sTime = Replace(sTime,":","-")

sCurrentDateTime = Year(Date) & "-" & Month(Date) & "-" & Day(Date) & "-" & sTime

sCurrentDateTime = Trim(sCurrentDateTime)

ReportName = "AutomationResult-" & sCurrentDateTime

ResultFileURL = "D:\Documents and Settings\nsharifu\Desktop\" & ReportName & ".html"

Set FSO = CreateObject("Scripting.FileSystemObject")


   If  (FSO.FileExists(ResultFileURL)) then


   end if


                ScenarioType = "Verify MAP id for MAP name"

                StatusFontColor = "black"

                TestStatus = "PASS"

                ResultDescription = "Map ID is : 22"

                ImageLink = ""

                ImageTitle = ""


'''' Calling function first time.



                Call funHTMLResult(ScenarioType,StatusFontColor,TestStatus,ResultDescription,ImageLink,ImageTitle,ResultFileURL)


                ScenarioType = "Row Count For MAP in Database"

                StatusFontColor = "black"

                TestStatus = "PASS"

                ResultDescription = "Row Count for Map ID: 22 Is  : 5 "

                ImageLink = ""

                ImageTitle = ""


'''''Calling function second time.


                Call funHTMLResult(ScenarioType,StatusFontColor,TestStatus,ResultDescription,ImageLink,ImageTitle,ResultFileURL)





'''''' REPORT FUNCTION ''''''''''''



Function funHTMLResult (ScenarioType,StatusFontColor,TestStatus,ResultDescription,ImageLink,ImageTitle,ResultFileURL)


        ReportType = "Testing report"

        ReportTitle = "Test Automation Run Results"

                                dCurrentDate = Now()

                                Set FSO = CreateObject("Scripting.FileSystemObject")


                                'If  (FSO.FileExists(ResultFileURL)) then


                                'end if

                                If NOT (FSO.FileExists(ResultFileURL)) Then

                                                 Set QuickSummHtmlFile = FSO.CreateTextFile(ResultFileURL, true)

                                                 QuickSummHtmlFile.Write ("<html><head><title>" & ReportTitle & "</title></head>")

                                                 QuickSummHtmlFile.Write ("<body bgcolor=#ffffcc><table width=100% bgcolor=#FFFFFF border=1 cellpadding=3 cellspacing=0>")

                                                 QuickSummHtmlFile.Write ("<tr bgcolor=#CBD9F4><div align=center><p><strong>TEST RESULTS FOR - " + ReportType + "</strong></p></div></tr>")

                                                 QuickSummHtmlFile.Write ("<tr><td bgcolor=#CBD9F4 align=center width = 20%>TEST SCENARIO/ACTION</td><td bgcolor=#CBD9F4 align=center width = 10%>TEST RESULTS STATUS</td><td bgcolor=#CBD9F4 align=center width = 70%>DESCRIPTION OF TEST SCENARIO/ACTION</td></Table>")

                                                 QuickSummHtmlFile.Write ("<div style =" + chr(34) + "overflow: scroll; height: 34em;" + chr(34) + "><table width=100% bgcolor=#FFFFFF border=1 cellpadding=3 cellspacing=0>")

                                                 QuickSummHtmlFile.Write ("<table width=100% bgcolor=#FFFFFF border=1 cellpadding=3 cellspacing=0><TR><TD align=center><font color=black>!!!START OF TESTCASE *** "& dCurrentDate & "!!!</font></TD></TR></table>")


                                End If


                                                Set QuickSummHtmlFileApp = FSO.OpenTextFile(ResultFileURL, 8, true)



                                   QuickSummHtmlFileApp.Write ("<table width=100% bgcolor=#FFFFFF border=1 cellpadding=3 cellspacing=0><TR bgColor=#CC99FF><TD WIDTH = 20%>" & ScenarioType & "</TD><TD WIDTH = 10%><font color="& StatusFontColor &">" & TestStatus & "</font></TD><TD WIDTH=70%>" & ResultDescription & "<br><b><a href = " & ImageLink & ".bmp style=" & chr(34) & "text-decoration:none; color:grey;" & chr(34) & ">" & ImageTitle & "</b></a></TD></TR></table> ")

                                   'QuickSummHtmlFileApp.Write ("<table width=100% bgcolor=#FFFFFF border=1 cellpadding=3 cellspacing=0><TR><TD WIDTH = 20%>" + CheckTyp + "</TD><TD WIDTH = 20%><font color="+ StatusFontColor +">" + TestStatus + "</font></TD><TD WIDTH=60%>" + ResultDescription + "</TD></TR></table>")

                                                'QuickSummHtmlFileApp.Write ("<table width=100% bgcolor=#FFFFFF border=1 cellpadding=3 cellspacing=0><TR><TD align=center><font color=black>!!!END OF TESTCASE *** "& dCurrentDate & "!!!</font></TD></TR></table>")


End Function








TTWT Magazine





© 2022   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service