The below code is helpful in adding and removing the Recovery Scenario dynamically from the settings. This case would be particularly required in case where there is a looping of the recovery scenarios, i.e, a recovery scenario is triggered when inside another recovery scenario.
Here goes the code:
Set qtApp = CreateObject("QuickTest.Application")
Set qtTestRecovery = qtApp.Test.Settings.Recovery
'This part of the code is used to remove all the existing recovery scenarios associated with the test
If qtTestRecovery.Count > 0 Then
qtTestRecovery.RemoveAll
End If
' This is used to add the recovery scenarios. The first parameter is the location of the qrs file. 2nd parameter is the scenario name as given at the time of creating the recovery scenario and 3rd is the priority (used when multiplr scenarios need to be added. At that time we can have 1,2,3 etc)
qtTestRecovery.Add "E:\RecoveryScenario.qrs", "RecoveryScenario" , 1
For intIndex = 1 To qtTestRecovery.Count
qtTestRecovery.Item(intIndex).Enabled = True
Next
qtTestRecovery.Enabled = true
qtTestRecovery.SetActivationMode "OnError"
Set qtApp = Nothing
Set qtTestRecovery = Nothing
'Only if the below line of code is added the recovery scenario would be added to your code.
Recovery.Enabled= True
Pls can u explain with a simple example
ReplyDelete