Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"HTML Report"
#1
Solved: 10 Years, 7 Months, 2 Weeks ago
Hi Folks,

Yesterday I atteneded one interview in that he asked question like I have a web page in that I have webtable, How to get webtable data and use that data generate HTML report so please any one give me an idea on above question.
Reply
#2
Solved: 10 Years, 7 Months, 2 Weeks ago
I am not sure if i have understood correctly...

You will be able to get WebTable HTML source code using WebTable().GetRoProperty("outerhtml")

Store it in a variable and write it in your html report. it will give the snapshot of webtable in ur result...
Reply
#3
Solved: 10 Years, 7 Months, 2 Weeks ago
i also faced the problem real time in my company. To get HTML report there is registry modification of qtp registries. HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\Logger\Media\Log Change the active DWORD from 0 to 1. What ever is running in qtp script it will generate HTML report at the time of result and it will save it folder name LOG in Results folder

For Eg: F:\Automation Projects\VFS\Res1\Log
Reply
#4
Solved: 10 Years, 7 Months, 2 Weeks ago
For doing so you are expected to have basic html skills.If you already have, then you may write the html code in a text file and save as .html file.Get the cell data from webtable(use getcelldata method) and write it accordingly.
For your easy reference see the below code.
Code:
Set fso=CreateObject("Scripting.FileSystemObject")
Set f= fso.CreateTextFile("C:\html.txt",1)
f.WriteLine "<html>"
f.WriteLine "<body>"
f.WriteLine  "<table border=10>"
f.WriteLine "<tr>"
f.WriteLine "<td>UserId</td>"
f.WriteLine "<td><input type=text/></td>"
f.WriteLine "</tr>"
f.WriteLine"</table>"
f.WriteLine"</body>"
f.WriteLine "</html>"
f.close
Set f= nothing
Set fso=nothing
Reply
#5
Solved: 10 Years, 7 Months, 2 Weeks ago
Why you want to write a script while you are getting html report with small registry tweak so instead of writing the script do the registry tweak
Reply
#6
Solved: 10 Years, 7 Months, 2 Weeks ago
Vinod123, Question in context is not about getting result report in html, the question is display the content of the web table in html and generate.

Ravi.gajul has correctly replied, we have to use file system object to write the content in the html way. use proper formatting as well to display the content in aligned way.

Below is what I tried and working-

Code:
Set fso = CreateObject("Scripting.FileSystemObject")
    Set MyFile = fso.CreateTextFile("C:\Documents and Settings\" & Environment("UserName") & "\Desktop\testResult_"& myDate & "-" & myTempTime &".html", True)
    MyFile.WriteLine "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">"
    MyFile.WriteLine "<HTML>"
    MyFile.WriteLine "<HEAD>"
    MyFile.WriteLine "<TITLE> Sanity Tests run on Magnet Dev</TITLE>"
    MyFile.WriteLine "<META http-equiv=Content-Type content="&Chr(34)&"text/html; charset=windows-1252"&Chr(34)&">"
    MyFile.WriteLine "<STYLE type=text/css>TD {"
    MyFile.WriteLine "FONT-SIZE: 10pt; FONT-FAMILY: Verdana"
    MyFile.WriteLine"}"
    MyFile.WriteLine "</STYLE>"
    MyFile.WriteLine "<META content="&Chr(34)&"MSHTML 6.00.6000.17107"&Chr(34)&" name=GENERATOR></HEAD>"
    MyFile.WriteLine "<BODY>"
    MyFile.WriteLine "<TABLE borderColor=#336699 cellSpacing=2 cellPadding=2 bgColor=#ffffcc border=2><TBODY>"
    MyFile.WriteLine "<tr>"
    MyFile.WriteLine "<th bgColor=#ccffff> Action Performed</th>"
    MyFile.WriteLine"<th bgColor=#ccffff> Expected Result</th>"
    MyFile.WriteLine "<th bgColor=#ccffff> Actual Result</th>"
Reply
#7
Solved: 10 Years, 7 Months, 2 Weeks ago
Hi ,

If you are using UFT there is a settings in Options
Tools>>Options>>Run Sessions>>Click on 'Configure' You get an Popup 'Configure Automatic Export of Run Results' using these settings you can export you r results to HTML format
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)