Example Usage:
Call CaptureScreen("Pass", "The test passed")
----------------------------------------------------------------------------------
Public Sub CaptureScreen(Result, Details)
'********************************************
' Author : Chinmay Mudholkar
' Purpose : Taking a screenshot of the current screen and inserting it in the test results with the specified result type
' Inputs : Result: The result type
' Details: The details about the screenshot/report
' Returns : None
'********************************************
'Capture the screenshot in a temp file first, do everything else later
Desktop.CaptureBitmap Environment.Value("TestDir") & "\temp.bmp", True
Dim imgname, imgpath, fso
If Details = "" Or IsEmpty(Details) Then
Details = Result
End If
imgname = "temp.bmp"
imgpath = Environment.Value("TestDir") & "\" & imgname
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(imgpath) Then
If UCase(Result) = "PASS" Then
Reporter.ReportEvent micPass, "Captured Screen", Details, imgpath
ElseIf UCase(Result) = "FAIL" Then
Reporter.ReportEvent micFail, "Captured Screen", Details, imgpath
Else
Reporter.ReportEvent micDone, "Captured Screen", Details, imgpath
End If
fso.DeleteFile imgpath, True
End If
End Sub
Call CaptureScreen("Pass", "The test passed")
----------------------------------------------------------------------------------
Public Sub CaptureScreen(Result, Details)
'********************************************
' Author : Chinmay Mudholkar
' Purpose : Taking a screenshot of the current screen and inserting it in the test results with the specified result type
' Inputs : Result: The result type
' Details: The details about the screenshot/report
' Returns : None
'********************************************
'Capture the screenshot in a temp file first, do everything else later
Desktop.CaptureBitmap Environment.Value("TestDir") & "\temp.bmp", True
Dim imgname, imgpath, fso
If Details = "" Or IsEmpty(Details) Then
Details = Result
End If
imgname = "temp.bmp"
imgpath = Environment.Value("TestDir") & "\" & imgname
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(imgpath) Then
If UCase(Result) = "PASS" Then
Reporter.ReportEvent micPass, "Captured Screen", Details, imgpath
ElseIf UCase(Result) = "FAIL" Then
Reporter.ReportEvent micFail, "Captured Screen", Details, imgpath
Else
Reporter.ReportEvent micDone, "Captured Screen", Details, imgpath
End If
fso.DeleteFile imgpath, True
End If
End Sub
----------------------------------------------------------------------------------