We can iterate all library files attached to test in QTP using below code.
Set qtpApp = CreateObject("QuickTest.Application")
qtpApp.Launch
qtpApp.Visible = True
Set qtLibraries = qtpApp.Test.Settings.Resources.Libraries
' Get the libraries collection object
For each l in qtLibraries
'here we are printing the names of all library files associated with this test.
print l
Next
We can also associate the library file to test at runtime using below code
qtLibraries.Add "C:\book.vbs"
' Add the library file viz. book.vbs to the collection.
We can also check if given file is associated with the test using below code.
If qtLibraries.Find("C:\myfile.vbs") = -1 Then
print "library file not found"
else
print "library file found"
End If
'Save the test
qtpApp.Test.Save
qtpApp.Quit
' Quit QuickTest
Set qtLibraries = Nothing
Set qtpApp = Nothing
Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts.
Set qtpApp = CreateObject("QuickTest.Application")
qtpApp.Launch
qtpApp.Visible = True
Set qtLibraries = qtpApp.Test.Settings.Resources.Libraries
' Get the libraries collection object
For each l in qtLibraries
'here we are printing the names of all library files associated with this test.
print l
Next
We can also associate the library file to test at runtime using below code
qtLibraries.Add "C:\book.vbs"
' Add the library file viz. book.vbs to the collection.
We can also check if given file is associated with the test using below code.
If qtLibraries.Find("C:\myfile.vbs") = -1 Then
print "library file not found"
else
print "library file found"
End If
'Save the test
qtpApp.Test.Save
qtpApp.Quit
' Quit QuickTest
Set qtLibraries = Nothing
Set qtpApp = Nothing
This is how we can work with QTP libraries.
Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts.
No comments:
Post a Comment
Please Leave your reply. We value your feedback and inputs