Custom Search

Tuesday, May 10, 2011

Adding Library files to QTP at run time

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable

Dim qtLibraries 'As QuickTest.TestLibraries ' Declare a test's libraries collection variable
Dim lngPosition
' Open QuickTest
Set qtApp = CreateObject( QuickTest.Application ) ' Create the Application object
qtApp.Launch ' Launch QuickTest
qtApp.Visible = True ' Set QuickTest to be visible
' Open a test and get its libraries collection
qtApp.Open C:\Test1 False False ' Open a test
Set qtLibraries = qtApp.Test.Settings.Resources.Libraries ' Get the libraries collection object
' Add Utilities.vbs if it's not in the collection
If qtLibraries.Find( C:\sai1.vbs ) = -1 Then ' If the library cannot be found in the collection
     qtLibraries.Add C:\sai1.vbs 1 ' Add the library to the collection
End If

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.