Monday, September 21

VBScript - 4 Add Recovery Scenario

This blog is in sequence with my previous blogs and they are shown below.


VBScript - 1 . Launching QTP
VBScript - 2 . Connecting to QC/Open QC test
VBScript - 3. Add Resources of the Script

Here we shall move to see how we can add recovery scenarios and arrange their priority




----------------------------------------------------------------------

'Code Begin
'Declare the resources as constant. You necessarily need not do this. You take this input from attributes or excel files or any text file. 

Const rRecoveryName1 = "rec1.qrs"
Const rRecoveryPath1  = "clClasses.vbs"
Const rRecoveryName2 = "[QualityCenter] Subject/Abcd/"
Const rRecoveryPath2= "[QualityCenter] Subject/Dfgs/"





Dim rRecoveries 


Set rRecoveries  = appQTP.Test.Settings.Recovery


Remove any default recovery scenarios
If rRecoveries.Count >0 then
     rRecoveries.RemoveAll

end if



'syntax object.Add ScenarioFile, ScenarioName, [Position]
rRecoveries.add rRecoveryPath1,rRecoveryName1 ,1
rRecoveries.add rRecoveryPath2,rRecoveryName2 ,2


'After adding now enable the recovery mechanism
rRecoveries.enabled = True


'Set activation mode for recovery scenarios
rRecoveries.SetActivationMode "OnError"


'At the end, Save the test

appQtp.Test.save


Here we done with adding recovery scenarios.

---------------------------------------------

Related Posts Plugin for WordPress, Blogger...