Hi Friends it is very useful to who want to write QTP Certification test& Along with who are trying jobs on QTP.
We can use below code, To Associate the Function Library In run time to QTP test
'qtpo= QTP Object, to open QTP
'flo=Function Lib, for Add to test
Set qtpo = CreateObject("QuickTest.Application")
qtpo.Launch
qtpo.Visible = True
'Open the test
qtpo.Open"D:\GUITest2"
Set flo = objQTP.Test.Settings.Resources.Libraries
'Associate Function Library if NOT associated already.
If flo.Find("C:\lib1.vbs") = -1 Then
flo.Add "C:\lib1.vbs", 1
End
'flo=Function Lib, for Add to test
Set qtpo = CreateObject("QuickTest.Application")
qtpo.Launch
qtpo.Visible = True
'Open the test
qtpo.Open"D:\GUITest2"
Set flo = objQTP.Test.Settings.Resources.Libraries
'Associate Function Library if NOT associated already.
If flo.Find("C:\lib1.vbs") = -1 Then
flo.Add "C:\lib1.vbs", 1
End
We can Use below code, TO associate the Recovery Scenario in Run-TIme to QTP Test
'qtpo= QTP Object, to open QTP
'rso=Recovery Scenario object, to add in run time
Set qtpo = CreateObject("QuickTest.Application")
qtpo.Launch
qtpo.Visible = True
Set rso=qtpo.Test.Settings.Recovery
If rso.count>0 Then
rso.RemoveAll
End If
rso.Add"File path","Scenario name"
'rso=Recovery Scenario object, to add in run time
Set qtpo = CreateObject("QuickTest.Application")
qtpo.Launch
qtpo.Visible = True
Set rso=qtpo.Test.Settings.Recovery
If rso.count>0 Then
rso.RemoveAll
End If
rso.Add"File path","Scenario name"
No comments:
Post a Comment