Object Identification in QTP Automation testing
Description
Description
Returns the number of recovery scenarios associated with the current test.
Syntax
Recovery.Count
Return Value
Number
Example
The following example uses the Count property to return the number of recovery scenarios associated with the current test and then uses this information to perform various operations on the scenarios.
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 ?"
ScenarioName & " from " & ScenarioFile & " enabled ?"
ScenarioFile = Empty
ScenarioName = Empty
Next
Description
Recovery default property. Retrieves or sets the status of the recovery scenario mechanism for the current test.
Syntax
To retrieve the recovery scenario mechanism status:
Recovery.Enabled
or
Recovery
To set the recovery scenario mechanism status:
Recovery.Enabled =Status
or
Recovery =Status
Argument
|
Type
|
Description
|
---|---|---|
Status
|
Boolean
|
The status of the specified scenario (True = enabled or False = disabled).
|
Example
The following example uses the Enabled property to check the status of the recovery mechanism, and enables it if it is disabled. It then activates any recovery scenarios associated with the test, and then returns the recovery mechanism to its former status.
MyCurrentStatus=Recovery.Enabled
If Not( MyCurrentStatus ) Then
Recovery.Enabled=True
End If
Recovery.Activate
Recovery = MyCurrentStatus
If Not( MyCurrentStatus ) Then
Recovery.Enabled=True
End If
Recovery.Activate
Recovery = MyCurrentStatus
Note: You could omit the word Enabled in the statement above, because Enabled is the default property for the Recovery object.
Post a Comment