Hi Morgan,
1) I am working on a handler for OnLogError that stops script execution after a certain number of errors |
Here is the sample script:
If Log.ErrCount > 3 Then
Log.Message "Max number of errors reached - Test execution halted"
Runner.Stop
End If
2) Secondly, I was wondering if it was possible to create a script that (on region checkpoint error) attains the actual region image used, assigns it a name of your choosing and puts it in a folder along with the diff file and expected image. I'm not sure if this is possible with a handler...? The actual images saved to the TC directory are hard to sort through and match up. Basically for the project I am working on, we'd like to attain the expected, actual, and dif .pngs so we can manually look through the differences |
You can use the
Picture.Difference method:
Set Pict = Sys.Desktop.PictureUnderMouse(20, 20, False)
Set StoredPict = Regions.GetPicture("StoredImageName")
Set DiffPicture = StoredPict.Difference(Pict)
If Not DiffPicture Is Nothing Then
Call Pict.SaveToFile("C:\Folder\Results\Compares\StoredImageName_ACTUAL.png")
Call StoredPict.SaveToFile("C:\Folder\Results\Compares\StoredImageName.png")
Call DiffPicture.SaveToFile("C:\Folder\Results\Compares\Differences.png")
Call Log.Message("Compare Files Saved to C:\Folder\Results\Compares")
End If
Note that C:\Folder\Results\Compares must exist to save files to it. For more information, refer to the
Picture.SaveToFile help topic.