Forum Discussion
The code didn't originate with me so I'm just guessing...
BUT... resfile, as I read the code, is the FQN of the output file for the html report. e.g., C:\\reportfiles\\myreport.html. Obviously, you want to do things a LITTLE bit smarter like build the file name based upon date and time for the report output... but hopefully you get the idea.
As for value, I believe that is specifically the text that you want to be added as a record to the table. Now, you can add that text specifically and explicitly yourself OR you could write code to parse out the native log file and dump that to your HTML. Either way, value is your ACTUAL result text you want to show up in the file.
That's my best guess, at least...
Keep in mind, also, that the code you pasted is VBScript so you'll have to do the necessary syntax changes for it to be formatted for Python.
- JackSparrow9 years agoFrequent Contributor
tristaanogre thanks for the info
if am not wrong this how in python the code looks like
def PageHeader(resfile): aqFile.WriteToTextFile(resfile, "<html>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "<head>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "<title> Automation Results </title>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "</head>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "<body>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "<table width=90% border=2 bordercolor=" & "#000000 id=table1 bordercolorlight=" & "#000000>", aqFile.ctUnicode) return def AddHtml_Results(resfile,Value): aqFile.WriteToTextFile(resfile, "<tr>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "<td width=80% bgcolor = #000000 >", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, value, aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "</td>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "</tr>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "</table>", aqFile.ctUnicode) return def PageFooter(resFile): aqFile.WriteToTextFile(resfile, "</body>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "</html>", aqFile.ctUnicode) return
Do i Need to maintain all those header then middle of html and footer separately cant we merge all the 3 things into single function.
- JackSparrow9 years agoFrequent Contributor
And after the Execution the Report is looking like this
anyone can give me guidance on this
and code which i used is
def Reporting(resfile,Value): aqFile.Create("C:\\work\\myreport.html") aqFile.WriteToTextFile(resfile, "<html>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "<head>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "<title> Automation Results </title>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "</head>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "<body>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "<table width=90% border=2 bordercolor=" + "#000001 id=table1 bordercolorlight=" + "#000001>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "<tr>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "<td width=80% bgcolor = #000000 >", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, Value, aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "</td>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "</tr>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "</table>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "</body>", aqFile.ctUnicode) aqFile.WriteToTextFile(resfile, "</html>", aqFile.ctUnicode) def testcas1(): Reporting("C:\\work\\myreport.html",'Hello Reporting')
- baxatob9 years agoCommunity Hero
Your code works fine :)
This is what I see:
Possibly you need to add a tag to control the color of the font.
P.S. Imho building report like you do - is a very very fragile way. Imagine that sometime you will require more complex grid.
- tristaanogre9 years agoEsteemed Contributor
Hey, Jack... IIRC, this thread is because you need a summary report for each test item being executed, is that correct? At least, that's what I remember from some previous conversations.
Check out my latest response on your other thread
https://community.smartbear.com/t5/TestComplete-Desktop-Testing/Batch-Execution-of-100-Test-Cases-and-Summary-Report-of-Batch/m-p/129909/highlight/true#M7611