Quality is delighting customers
Tags:
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
fso.DeleteFile(ResultFileURL)
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
'fso.DeleteFile(ResultFileURL)
'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>")
QuickSummHtmlFile.Close()
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>")
QuickSummHtmlFileApp.Close()
End Function
© 2022 Created by Quality Testing.
Powered by