*****************************************************************
Load recovery scenarios at Runtime
*****************************************************************
Loading Recovery we can do in two ways
1)Static loading
2)Dynamic or Run time loading
********************************************************************
Static loading :
********************************************************************
Static loading we can do directly from QTP recovery scenario window
********************************************************************
Dynamic or Run time loadingFunction LoadRecoveryScenarios
********************************************************************
On Error Resume Next
strRecoveryScenarioPath = Environment.Value("strMasterTestSuitePath") & "\RecoveryScenario\"
' Create the Application object
Set objQTP = CreateObject("QuickTest.Application")
' Return the Recovery object for the current test
Set objQTPTestRecovery = objQTP.Test.Settings.Recovery
' Add the " Server Error " scenario as the first scenario
objQTPTestRecovery.RemoveAll
objQTPTestRecovery.Add strRecoveryScenarioPath & "\" & "RecoveryScenario.qrs", "ServerError1", 1
objQTPTestRecovery.Add strRecoveryScenarioPath & "\" & "RecoveryScenario.qrs", "ServerError2", 2
objQTPTestRecovery.Add strRecoveryScenarioPath & "\" & "RecoveryScenario.qrs", "ServerError3", 3
' Iterate the scenarios
For intIndex = 1 To objQTPTestRecovery.Count
' Enable each Recovery Scenario (Note: the 'Item' property is default and can be omitted)
objQTPTestRecovery.Item(intIndex).Enabled = True
Next
' Enable the recovery mechanism (with default, on errors, setting)
objQTPTestRecovery.Enabled = True
'Ensure that the recovery mechanism is set to be activated only after errors
objQTPTestRecovery.SetActivationMode "OnEveryStep" '"OnError" OnEveryStep
Set objQTP = Nothing ' Release the Application object
Set objQTPTestRecovery = Nothing ' Release the Recovery object
End Function
Load recovery scenarios at Runtime
*****************************************************************
Loading Recovery we can do in two ways
1)Static loading
2)Dynamic or Run time loading
********************************************************************
Static loading :
********************************************************************
Static loading we can do directly from QTP recovery scenario window
********************************************************************
Dynamic or Run time loadingFunction LoadRecoveryScenarios
********************************************************************
On Error Resume Next
strRecoveryScenarioPath = Environment.Value("strMasterTestSuitePath") & "\RecoveryScenario\"
' Create the Application object
Set objQTP = CreateObject("QuickTest.Application")
' Return the Recovery object for the current test
Set objQTPTestRecovery = objQTP.Test.Settings.Recovery
' Add the " Server Error " scenario as the first scenario
objQTPTestRecovery.RemoveAll
objQTPTestRecovery.Add strRecoveryScenarioPath & "\" & "RecoveryScenario.qrs", "ServerError1", 1
objQTPTestRecovery.Add strRecoveryScenarioPath & "\" & "RecoveryScenario.qrs", "ServerError2", 2
objQTPTestRecovery.Add strRecoveryScenarioPath & "\" & "RecoveryScenario.qrs", "ServerError3", 3
' Iterate the scenarios
For intIndex = 1 To objQTPTestRecovery.Count
' Enable each Recovery Scenario (Note: the 'Item' property is default and can be omitted)
objQTPTestRecovery.Item(intIndex).Enabled = True
Next
' Enable the recovery mechanism (with default, on errors, setting)
objQTPTestRecovery.Enabled = True
'Ensure that the recovery mechanism is set to be activated only after errors
objQTPTestRecovery.SetActivationMode "OnEveryStep" '"OnError" OnEveryStep
Set objQTP = Nothing ' Release the Application object
Set objQTPTestRecovery = Nothing ' Release the Recovery object
End Function
No comments:
Post a Comment