Saturday

QTP- recover Scenario

.qrs file created
QTP recovery senario only invoke in test object...
x=4/y par will not invoke... use on error resume next instead
-----
Trigger and recovery steps
popup -> spy
Object state -> Spy the object state -> function call
Run error -> any error , obj not found , duplicate found -> function call
Application error -> crash etc -> function call

Step: Run current action , iteration , stop, re run cuurent , start window etc



to explicitly invoke recovery
Recovery.Activate
Calling function:
put the action status failed
Function RecoveryFunction1(Object, Method, Arguments, retVal)
sCurrentAction=Enviornment. Value("CurrentAction")
Enviornment. Value(sCurrentAction)="Failed"
Enviornment. Value("RunStatus")="Failed"
End Function
**************************
Recovery Object
Recovery.Activate'Retrieves the name and source file of a recovery scenario, according to the specified position in the list of recovery scenarios associated with the test. Recovery.GetScenarioName
'Returns the position of a recovery scenario in the list of recovery scenarios associated with the test, according to the specified name and source file. Recovery.GetScenarioPosition
'Returns the status of a recovery scenario (True = enabled or False = disabled), according to the specified position in the list of recovery scenarios associated with the test. Recovery.GetScenarioStatus
'Enables or disables the specified recovery scenario, according to its position in the list of recovery scenarios associated with the test. Recovery.SetScenarioStatus
'Enable or disable recovery by Recovery.Enable=False'orRecovery=False
'The following example uses the SetScenarioStatus method to disable the status of the second scenario associated with the test.
msgbox Recovery.Count,, "Number of Recovery Scenarios"
msgbox Recovery, "Is Recovery enabled?"
for Iter = 1 to Recovery.Count
Recovery.GetScenarioName Iter, ScenarioFile, ScenarioName
Position = Recovery.GetScenarioPosition( ScenarioFile, ScenarioName )
msgbox Recovery.GetScenarioStatus( Position ), "Is scenario " & _ ScenarioName & " from " & ScenarioFile & " enabled ?"
ScenarioFile = Empty
ScenarioName = Empty
Next
Recovery.Activate
Recovery.SetScenarioStatus 2, False
Recovery.Activate
*************************

No comments:

Post a Comment