Skip to content

Instantly share code, notes, and snippets.

@antsmartian
Last active December 19, 2015 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antsmartian/99e39057f487a4dfefae to your computer and use it in GitHub Desktop.
Save antsmartian/99e39057f487a4dfefae to your computer and use it in GitHub Desktop.
Vb report generation
'Helper class to generate html and
'handle file writing
Class HtmlReportGenerator
Private fileHandle
Private objFSO
Private objFile
Private Sub Class_Initialize()
set objFSO = CreateObject("Scripting.FileSystemObject")
outFile = "C:\Users\MSR\Desktop\anto\report.html" ' change the address
libFolder = "C:\Users\MSR\Desktop\anto\lib\"
'libFolder = InputBox("Please enter a location of js dependencies","")
'outFile = InputBox("Please enter a location for your report file:","")
Set objFile = objFSO.CreateTextFile(outFile,true)
objFile.write "<html><script src='" & libFolder & "jquery.js" & "'></script>"
objFile.write "<link rel='stylesheet' type='text/css' href='" & libFolder & "bootstrap.css" &"'>"
objFile.write "<link rel='stylesheet' type='text/css' href='" & libFolder & "icons.css" & "'>"
objFile.write "<script src='" & libFolder & "bootstrapjs.js" & "'></script><body style='font-family: Calibri , sans-serif'>"
objFile.write "<div id='banner' class='container'><div class='jumbotron'><center><h2>Test Automation Execution Report</h2>"
objFile.write "<span><b>Project Name: </b><span id='projectname'></span></span>&nbsp;&nbsp;"
objFile.write "<span><b>Application Name: </b><span id='appname'></span></span>&nbsp;&nbsp;"
objFile.write "<span><b>Test Date: </b><span id='testdate'></span></span>&nbsp;&nbsp;"
objFile.write "<span><b>Executed By: </b><span id='executedby'></span></span>&nbsp;&nbsp;</center><br></br>"
objFile.write "<span><b>Start time: </b><span id='starttime'></span></span><br>"
objFile.write "<span><b>End time: </b><span id='endtime'></span></span><br>"
objFile.write "<span><b>Execute time: </b><span id='et'></span></span><br>"
objFile.write "</div></div>"
objFile.write "<div id='report'>"
End Sub
Private Sub Class_Terminate()
End Sub
Public Sub close
objFile.write "<script>function hideAll(){$('table').hide();$('#footer').show();$('.testdata').hide();$('.teststeps').hide();$('hr').hide();} hideAll()</script> </div></body></html>"
objFile.close
End Sub
Public Sub generateExpandCollapseButtons()
'Expand all
objFile.write "<span class='glyphicon glyphicon-plus' style='margin-left:20px;'></span>"
objFile.write "<a href='#' onclick=(function(){$('.testdata').show();$('.teststeps').show();$('hr').show();$('#report').find('div').find('span').removeClass();$('#report').find('div').find('span').addClass('glyphicon');$('#report').find('div').find('span').addClass('glyphicon-minus');})()>Expand All</a>"
'Collapse All
objFile.write "<span class='glyphicon glyphicon-minus' style='margin-left:20px;'></span>"
objFile.write "<a href='#' onclick=(function(){$('.testdata').hide();$('.teststeps').hide();$('hr').hide();$('#report').find('div').find('span').removeClass();$('#report').find('div').find('span').addClass('glyphicon');$('#report').find('div').find('span').addClass('glyphicon-plus');})()>Collapse All</a>"
objFile.write "</br></br>"
End Sub
Public Sub generateSuiteName(suiteName)
Dim div
div = "<div style='margin-left:20px;'><span class='glyphicon glyphicon-plus' style='cursor: pointer' onclick='(function(e){ $(e).parent().find(""div"").toggle(); $(e).parent().find(""div"").is("":visible"") ? $(e).parent().find(""hr"").show() : $(e).parent().find(""hr"").hide(); if($(e).attr(""class"").indexOf(""plus"") > -1) {$(e).removeClass(""glyphicon-plus"");$(e).addClass(""glyphicon-minus"")} else {$(e).removeClass(""glyphicon-minus"");$(e).addClass(""glyphicon-plus"")} }(this))' ></span>"
div = div & "<b style='color: #05B8EC'>" & suiteName & "</b>"
objFile.write div
End Sub
Public Sub generateTestCaseName(testCaseName)
Dim div , table
div = "<div class='testdata' style='margin-left:15px;'><span class='glyphicon glyphicon-plus' style='cursor: pointer' onclick='(function(e){$(e).parent().find(""table"").toggle(); if($(e).attr(""class"").indexOf(""plus"") > -1) {$(e).removeClass(""glyphicon-plus"");$(e).addClass(""glyphicon-minus"")} else {$(e).removeClass(""glyphicon-minus"");$(e).addClass(""glyphicon-plus"")}}(this))'></span><i>"
div = div & testCaseName & "</i>"
table = div & "<table class='table table-striped teststeps' style='margin-left:30px;'>" & "<tr><td><b>StepNo</b></td><td><b>Expected</b></td>"
table = table & "<td><b>Actual</b></td><td><b>Status</b></td><td><b>Screenshot</b></td><td><b>Comments</b></td></tr>"
objFile.write table
End Sub
Public Sub generateEndTestCase()
Dim endTag 'this is opened in generateTestCaseName
endTag = "</table></div>"
objFile.write endTag
End Sub
Public Sub generateReport(testSuite)
End Sub
Public Sub generateStepData(name,expected,actual,status,screenshot,comments)
Dim rows
rows = "<tr>"
rows = rows & "<td>" & name & "</td>"
rows = rows & "<td>" & expected & "</td>"
rows = rows & "<td>" & actual & "</td>"
rows = rows & "<td>" & status & "</td>"
rows = rows & "<td><a href='" & screenshot & "'>" & screenshot & "</a></td>"
rows = rows & "<td>" & comments & "</td>"
rows = rows & "</tr><tr><br></tr>"
objFile.write rows
End Sub
Public Sub generateHeader(projectName,appName,testDate,executedBy)
objFile.write "<script>function headerGenerator(){ $('#projectname').text('" & projectName & "'); $('#appname').text('" & appName & "') ; $('#testdate').text('" & testDate & "'); $('#executedby').text('" & executedBy & "'); } headerGenerator();</script>"
End Sub
Public Sub generateStats(starttime,endtime,et)
objFile.write "<script>function statsGenerator(){ $('#starttime').text('" & starttime &"'); $('#endtime').text('" & endtime & "'); $('#et').text('" & et & "')} statsGenerator();</script>"
End Sub
Public Sub generateEndSuite()
objFile.write "<hr/>"
objFile.write "</div><br>"
End Sub
Public Sub generateFooter(suiteDetailsArray)
Dim table,rows
table = "<br><br><b>Summary:</b><table class='table table-striped' id='footer' style='margin-left:30px;'>"
table = table & "<tr><td><b>Summary Of TestSuites</b></td><td><b>Passed</b></td><td><b>Failed</b></td>"
For Each suites in suiteDetailsArray
rows = "<tr>"
For Each suite in suites.getDetailInArray
rows = rows & "<td>" & suite & "</td>"
Next
rows = rows & "</tr>"
table = table & rows
Next
table = table & "</table>"
objFile.write table
End Sub
End Class
'Class to hold the data that is used in
'footer report generation.
Class SuiteDetails
Private testSuiteName
Private passCount
Private failCount
Private Sub Class_Initialize()
passCount = 0
failCount = 0
End Sub
Public Sub setSuiteName(val)
testSuiteName = val
End Sub
Public Function getSuiteName()
getSuiteName = testSuiteName
End Function
Public Sub increasePassCount()
passCount = passCount + 1
End Sub
Public Sub increaseFailCount()
failCount = failCount + 1
End Sub
Public Function getPassCount
getPassCount = passCount
End Function
Public Function getFailCount
getFailCount = failCount
End Function
'Returns the current object in the array
'Convinent for doing table formation.
Public Function getDetailInArray
set temp = CreateObject( "System.Collections.ArrayList" )
temp.Add testSuiteName
temp.Add passCount
temp.Add failCount
set getDetailInArray = temp
End Function
End Class
'A helper class, which handles creating objects on the fly
'for easy report generation.
Class ReportHelper
Dim htmlGenerator, testSuites , testCase , suiteDetailsArray , suiteDetail
Private Sub Class_Initialize()
set htmlGenerator = new HtmlReportGenerator
set suiteDetailsArray = CreateObject( "System.Collections.ArrayList" ) ' [ [] , [] , [] ]
htmlGenerator.generateExpandCollapseButtons()
End Sub
Public Sub StartSuite(suiteName)
htmlGenerator.generateSuiteName(suiteName)
set suiteDetail = New SuiteDetails
suiteDetail.setSuiteName suiteName
End Sub
Public Sub StartTest(testCaseName)
htmlGenerator.generateTestCaseName(testCaseName)
End Sub
Public Sub EndTest()
htmlGenerator.generateEndTestCase()
End Sub
Public Sub EndSuite()
suiteDetailsArray.Add suiteDetail
htmlGenerator.generateEndSuite()
End Sub
Public Sub ReportFail(name,expected,actual,screenshot,comments)
htmlGenerator.generateStepData name,expected,actual,"fail",screenshot,comments
End Sub
Public Sub ReportWarning(name,expected,actual,screenshot,comments)
htmlGenerator.generateStepData name,expected,actual,"warning",screenshot,comments
End Sub
Public Sub ReportPass(name,expected,actual,screenshot,comments)
htmlGenerator.generateStepData name,expected,actual,"pass",screenshot,comments
End Sub
Public Sub ReportHeader(projectname,appname,testdate,executedby)
htmlGenerator.generateHeader projectname,appname,testdate,executedby
End Sub
Public Sub ReportStats (starttime, endtime , et)
htmlGenerator.generateStats starttime, endtime , et
End Sub
Public Sub ReportFooter()
htmlGenerator.generateFooter(suiteDetailsArray)
End Sub
Public Sub Close
htmlGenerator.close
End Sub
End Class
Dim Report
Set Report = new ReportHelper
Report.StartSuite "Suite 1"
Report.StartTest "New test Name"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportFail "new name","1","1","C:/asd","New comments"
Report.EndTest
Report.StartTest "New test Name"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportFail "new name","1","1","C:/asd","New comments"
Report.EndTest
Report.StartTest "New test Name"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportFail "new name","1","1","C:/asd","New comments"
Report.EndTest
Report.EndSuite
Report.StartSuite "Suite 2"
Report.StartTest "New test Name"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportFail "new name","1","1","C:/asd","New comments"
Report.EndTest
Report.EndSuite
Report.StartSuite "Suite 3"
Report.StartTest "New test Name"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportFail "new name","1","1","C:/asd","New comments"
Report.EndTest
Report.EndSuite
Report.ReportHeader "New Project","App Name","12/04/05","Anto"
Report.ReportStats "12/12/04/05","12/12/04/05","1(hrs) 2 (min)"
Report.ReportFooter()
Report.Close
'Helper class to generate html and
'handle file writing
Class HtmlReportGenerator
Private fileHandle
Private objFSO
Private objFile
Private Sub Class_Initialize()
set objFSO = CreateObject("Scripting.FileSystemObject")
outFile = "C:\Users\MSR\Desktop\anto\report.html" ' change the address
libFolder = "C:\Users\MSR\Desktop\anto\lib\"
'libFolder = InputBox("Please enter a location of js dependencies","")
'outFile = InputBox("Please enter a location for your report file:","")
Set objFile = objFSO.CreateTextFile(outFile,true)
objFile.write "<html><script src='" & libFolder & "jquery.js" & "'></script>"
objFile.write "<link rel='stylesheet' type='text/css' href='" & libFolder & "bootstrap.css" &"'>"
objFile.write "<link rel='stylesheet' type='text/css' href='" & libFolder & "icons.css" & "'>"
objFile.write "<script src='" & libFolder & "bootstrapjs.js" & "'></script><body style='font-family: Calibri , sans-serif'>"
objFile.write "<div id='banner' class='container'><div class='jumbotron'><center><h2>Test Automation Execution Report</h2>"
objFile.write "<span><b><font size=3 color=660066>Project Name: </font></b><font size=2 color=#000000><span id='projectname'></font></span></span>&nbsp;&nbsp;"
objFile.write "<span><b><font size=3 color=660066>Application Name: </font></b><font size=2 color=#000000><span id='appname'></font></span></span>&nbsp;&nbsp;"
objFile.write "<span><b><font size=3 color=660066>Test Date: </font></b><font size=2 color=#000000><span id='testdate'></span></font></span>&nbsp;&nbsp;"
objFile.write "<span><b><font size=3 color=660066>Executed By: </font></b><font size=2 color=#000000><span id='executedby'></font></span></span>&nbsp;&nbsp;<br>"
objFile.write "<span><b><font size=3 color=660066>Start time: </font></b><font size=2 color=#000000><span id='starttime'></font></span></span>&nbsp;&nbsp;"
objFile.write "<span><b><font size=3 color=660066>End time: </font></b><font size=2 color=#000000><span id='endtime'></font></span></span>&nbsp;&nbsp;"
objFile.write "<span><b><font size=3 color=660066>Execute time: </font></b><font size=2 color=#000000><span id='totaltime'></font></span></span>&nbsp;&nbsp;</center>"
objFile.write "</div></div>"
objFile.write "<div id='report'>"
End Sub
Private Sub Class_Terminate()
End Sub
Public Sub close
objFile.write "<script>function hideAll(){$('table').hide();$('#footer').show();$('.testdata').hide();$('.teststeps').hide();$('hr').hide();} hideAll()</script> </div></body></html>"
objFile.close
End Sub
Public Sub generateExpandCollapseButtons()
'Expand all
objFile.write "<span class='glyphicon glyphicon-plus' style='margin-left:20px;'></span>"
objFile.write "<a href='#' onclick=(function(){$('.testdata').show();$('.teststeps').show();$('hr').show();$('#report').find('div').find('span').removeClass();$('#report').find('div').find('span').addClass('glyphicon');$('#report').find('div').find('span').addClass('glyphicon-minus');})()><b style='color: #0000FF'><font size=3>Expand All</font></b></a>"
'Collapse All
objFile.write "<span class='glyphicon glyphicon-minus' style='margin-left:20px;'></span>"
objFile.write "<a href='#' onclick=(function(){$('.testdata').hide();$('.teststeps').hide();$('hr').hide();$('#report').find('div').find('span').removeClass();$('#report').find('div').find('span').addClass('glyphicon');$('#report').find('div').find('span').addClass('glyphicon-plus');})()><b style='color: #0000FF'><font size=3>Collapse All</font></b></a>"
objFile.write "</br></br>"
End Sub
Public Sub generateSuiteName(suiteName,id)
Dim div
div = "<div id='" & id & "' style='margin-left:20px;'><span class='glyphicon glyphicon-plus' style='cursor: pointer' onclick='(function(e){ $(e).parent().find(""div"").toggle(); $(e).parent().find(""div"").is("":visible"") ? $(e).parent().find(""hr"").show() : $(e).parent().find(""hr"").hide(); if($(e).attr(""class"").indexOf(""plus"") > -1) {$(e).removeClass(""glyphicon-plus"");$(e).addClass(""glyphicon-minus"")} else {$(e).removeClass(""glyphicon-minus"");$(e).addClass(""glyphicon-plus"")} }(this))' ></span>"
div = div & "<p style='color: #CC0066;display : inline'><b>" & suiteName & "</b></p><p style=""display : inline""></p>"
objFile.write div
End Sub
Public Sub generateTestCaseName(testCaseName,id)
Dim div , table
div = "<div id='" & id & "' class='testdata' style='margin-left:20px;'><span class='glyphicon glyphicon-plus' style='cursor: pointer' onclick='(function(e){$(e).parent().find(""table"").toggle(); if($(e).attr(""class"").indexOf(""plus"") > -1) {$(e).removeClass(""glyphicon-plus"");$(e).addClass(""glyphicon-minus"")} else {$(e).removeClass(""glyphicon-minus"");$(e).addClass(""glyphicon-plus"")}}(this))'></span>"
div = div &"&nbsp;<p style=""display : inline""><b>"& testCaseName & "</b></p><p style=""display : inline""></p>"
table = div & "<table class='table table-striped teststeps' style='margin-left:10px;'>" & "<tr>"
table = table & "<td bgcolor=#336666><center><b style='color: #000000'><font size=3>StepNo</font></b></center></td><td bgcolor=#336666><Left><b style='color: #000000'><font size=3>Expected</font></b></Left></td>"
table = table & "<td bgcolor=#336666><Left><b style='color: #000000'><font size=3>Actual</font></b></left></td><td bgcolor=#336666><center><b style='color: #000000'><font size=3>Status</font></b></center></td>"
table = table & "<td bgcolor=#336666><center><b style='color: #000000'><font size=3>Screenshot</font></center></b></td><td bgcolor=#336666><Left><b style='color: #000000'><font size=3>Comments</font></b></Left></td></tr>"
objFile.write table
End Sub
Public Sub generateEndTestCase(id,status)
Dim endTag , script 'this is opened in generateTestCaseName
If status = 0 Then
script = "<script>$($('#" & id & " p')[1]).append(' <p style=""display : inline; background-color: #0BDE0B;"">&nbsp;Passed&nbsp;</p>')</script>"
Else
script = "<script>$($('#" & id & " p')[1]).append(' <p style=""display : inline; background-color: #C35818"">&nbsp;Failed&nbsp;</p>')</script>"
End If
endTag = "</table></div>" & script
objFile.write endTag
End Sub
Public Sub generateReport(testSuite)
End Sub
Public Sub generateStepData(name,expected,actual,status,screenshot,comments)
Dim rows
rows = "<tr>"
rows = rows & "<td bgcolor=#FFFFCC><center><font size=3 color=#000000>" & name & "</font></center></td>"
rows = rows & "<td bgcolor=#FFFFCC><Left><font size=3 color=#000000>" & expected & "</font></Left></td>"
rows = rows & "<td bgcolor=#FFFFCC><Left><font size=3 color=#000000>" & actual & "</font></Left></td>"
If Ucase(status) = "PASS" Then
rows = rows & "<td bgcolor=#FFFFCC><center><font size=3 color=#000000>" & status & "</font></center></td>"
Else
rows = rows & "<td bgcolor=#FFFFCC><center><font size=3 color=#CC0000>" & status & "</font></center></td>"
End If
rows = rows & "<td bgcolor=#FFFFCC><center><font size=3 color=#000000><a href='" & screenshot & "'>" & screenshot & "</a></font></center></td>"
rows = rows & "<td bgcolor=#FFFFCC><Left><font size=3 color=#000000>" & comments & "</font></Left></td>"
rows = rows & "</tr>"
objFile.write rows
End Sub
Public Sub generateHeader(projectName,appName,testDate,executedBy)
objFile.write "<script>function headerGenerator(){ $('#projectname').text('" & projectName & "'); $('#appname').text('" & appName & "') ; $('#testdate').text('" & testDate & "'); $('#executedby').text('" & executedBy & "'); } headerGenerator();</script>"
End Sub
Public Sub generateStats(starttime,endtime,et)
objFile.write "<script>function statsGenerator(){ $('#starttime').text('" & starttime &"'); $('#endtime').text('" & endtime & "'); $('#et').text('" & et & "')} statsGenerator();</script>"
End Sub
Public Sub generateEndSuite(id,passCount,failCount)
objFile.write "<hr/>"
objFile.write "</div><br>"
If passCount = 0 Then
script = "<script>$($('#" & id & " p')[0]).append(' <p style=""display : inline; background-color: #C35818;"">&nbsp;All Failed &nbsp;</p>')</script>"
Else If failCount = 0 Then
script = "<script>$($('#" & id & " p')[0]).append(' <p style=""display : inline; background-color: #0BDE0B;"">&nbsp;All Passed&nbsp;</p>')</script>"
Else If passCount > 0 and failCount > 0 Then
script = "<script>$($('#" & id & " p')[0]).append(' <p style=""display : inline; background-color: #C35818;"">&nbsp;" & failCount & "&nbsp;Failed &nbsp;</p>')</script>"
script = script & "<script>$($('#" & id & " p')[0]).append(' <p style=""display : inline; background-color: #0BDE0B;"">&nbsp;" & passCount & "Passed&nbsp;</p>')</script>"
End If
End If
End If
objFile.write script
End Sub
Public Sub generateFooter(suiteDetailsArray)
Dim table,rows
table = "<br><br><b><div align=center><p><Font size=5 color=#088A08><b style='color: #006600'><u>Overall Execution Summary</u></b></font></p></div></b><table class='table table-striped' id='footer' style='margin-left:50px;'>"
table = table & "<tr><td bgcolor=#336666><center><b><Font size=3 color=#FFFFFF>Test Suite Name</font></b></center></td><td bgcolor=#336666><center><b><Font size=3 color=#FFFFFF>#Test Cases Passed</font></b></center></td>"
table = table & "<td bgcolor=#336666><center><b><Font size=3 color=#FFFFFF>#Test Cases Failed</font></b></center></td>"
For Each suites in suiteDetailsArray
rows = "<tr>"
For Each suite in suites.getDetailInArray
rows = rows & "<td bgcolor=#CCFFCC><center><font size=3 color=#000000>" & suite & "</center></td>"
Next
rows = rows & "</tr>"
table = table & rows
Next
table = table & "</table>"
objFile.write table
End Sub
End Class
'Class to hold the data that is used in
'footer report generation.
Class SuiteDetails
Private testSuiteName
Private passCount
Private failCount
Private Sub Class_Initialize()
passCount = 0
failCount = 0
End Sub
Public Sub setSuiteName(val)
testSuiteName = val
End Sub
Public Function getSuiteName()
getSuiteName = testSuiteName
End Function
Public Sub increasePassCount()
passCount = passCount + 1
End Sub
Public Sub increaseFailCount()
failCount = failCount + 1
End Sub
Public Function getPassCount
getPassCount = passCount
End Function
Public Function getFailCount
getFailCount = failCount
End Function
'Returns the current object in the array
'Convinent for doing table formation.
Public Function getDetailInArray
set temp = CreateObject( "System.Collections.ArrayList" )
temp.Add testSuiteName
temp.Add passCount
temp.Add failCount
set getDetailInArray = temp
End Function
End Class
'A helper class, which handles creating objects on the fly
'for easy report generation.
Class ReportHelper
Dim htmlGenerator, testSuites , testCase , suiteDetailsArray , suiteDetail , isTestCasePassed , testCaseHtmlId , testSuiteHtmlId
Private Sub Class_Initialize()
set htmlGenerator = new HtmlReportGenerator
set suiteDetailsArray = CreateObject( "System.Collections.ArrayList" ) ' [ [] , [] , [] ]
htmlGenerator.generateExpandCollapseButtons()
End Sub
Public Sub StartSuite(suiteName)
testSuiteHtmlId = GetUniqueNumber()
htmlGenerator.generateSuiteName suiteName,testSuiteHtmlId
set suiteDetail = New SuiteDetails
suiteDetail.setSuiteName suiteName
End Sub
Public Sub StartTest(testCaseName)
testCaseHtmlId = GetUniqueNumber()
isTestCasePassed = 0
htmlGenerator.generateTestCaseName testCaseName,testCaseHtmlId
End Sub
Public Sub EndTest()
htmlGenerator.generateEndTestCase testCaseHtmlId, isTestCasePassed
'On end of test, find the test case passed or failed
If isTestCasePassed = 0 Then
suiteDetail.increasePassCount()
Else
suiteDetail.increaseFailCount()
End If
End Sub
Public Sub EndSuite()
suiteDetailsArray.Add suiteDetail
htmlGenerator.generateEndSuite testSuiteHtmlId,suiteDetail.getPassCount(),suiteDetail.getFailCount()
End Sub
Public Sub ReportFail(name,expected,actual,screenshot,comments)
htmlGenerator.generateStepData name,expected,actual,"fail",screenshot,comments
isTestCasePassed = 1
End Sub
Public Sub ReportWarning(name,expected,actual,screenshot,comments)
htmlGenerator.generateStepData name,expected,actual,"warning",screenshot,comments
End Sub
Public Sub ReportPass(name,expected,actual,screenshot,comments)
htmlGenerator.generateStepData name,expected,actual,"pass",screenshot,comments
End Sub
Public Sub ReportHeader(projectname,appname,testdate,executedby)
htmlGenerator.generateHeader projectname,appname,testdate,executedby
End Sub
Public Sub ReportStats (starttime, endtime , et)
htmlGenerator.generateStats starttime, endtime , et
End Sub
Public Sub ReportFooter()
htmlGenerator.generateFooter(suiteDetailsArray)
End Sub
Public Sub Close
htmlGenerator.close
End Sub
'This function generates the ids
'as needed for the html elements
'to paint the pass green stats
Public Function GetUniqueNumber()
'
' Generate Unique Timestamp
'
CurrentDateTime = Now()
YearYYYY = Right("0000" & Year(CurrentDateTime), 4)
MonthMM = Right("00" & Month(CurrentDateTime), 2)
DayDD = Right("00" & Day(CurrentDateTime), 2)
HourHH24 = Right("00" & Hour(CurrentDateTime), 2)
MinuteMM = Right("00" & Minute(CurrentDateTime), 2)
SecondSS = Right("00" & Second(CurrentDateTime), 2)
GetUniqueNumber = HourHH24 & MinuteMM & SecondSS & DayDD & MonthMM & YearYYYY & Int((5000+1)*Rnd+min)
End Function
End Class
Dim Report
Set Report = new ReportHelper
Report.StartSuite "Suite 1"
Report.StartTest "New test Name"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportFail "new name","1","1","C:/asd","New comments"
Report.EndTest
Report.StartTest "New test Name"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportFail "new name","1","1","C:/asd","New comments"
Report.EndTest
Report.StartTest "New test Name"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.EndTest
Report.EndSuite
Report.StartSuite "Suite 2"
Report.StartTest "New test Name"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportFail "new name","1","1","C:/asd","New comments"
Report.EndTest
Report.EndSuite
Report.StartSuite "Suite 3"
Report.StartTest "New test Name"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.EndTest
Report.StartTest "New test Name"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.ReportPass "new name","1","1","C:/asd","New comments"
Report.EndTest
Report.EndSuite
Report.ReportHeader "New Project","App Name","12/04/05","Anto"
Report.ReportStats "12/12/04/05","12/12/04/05","1(hrs) 2 (min)"
Report.ReportFooter()
Report.Close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment