Thursday, February 12, 2009

How to handle run time errors with Recovery scenario?

First create below function in function library. In this function, if we want to add additional features like Report, capture bitmap facilities etc.

Function RuntimeErrorHandle (Object, Method, Arguments, retVal)
Dim objReference, strClassName
Set objReference = Object
strClassName = objReference.GetTOProperty("Class Name")
Reporter.ReportEvent micFail,"Runtime Error"," Runtime Error Displayed and
stoped execution -- "&" Object Name:-- " & strClassName &" - Method - "&
Method& " -- ErrorNo: -- "&retVal
Desktop.CaptureBitmap "C:\ScreenShot.png"
ExitAction "Fail"
End Function

While creating Recovery scenario select
1. “Test Run Error” as Trigger Event
2. “Any error” from Error combo box
3. “Function Call” as Recovery Operation
4. Select Function Library and then select created function and finish with further steps.

No comments:

Post a Comment