Friday, July 11, 2008

Load the OR In QTP

Public Function load_obj_repository(ObjRepPath,Action_Name)

Dim qtAppDim qtRepositories

'As QuickTest.ObjectRepositories

' Declare an action's object repositories collection variable

Set qtApp = CreateObject("QuickTest.Application")

' Create the Application

objectSet qtRepositories = qtApp.Test.Actions(Action_Name).ObjectRepositories

' Get the object repositories collection object of the "Login" action
' Add MainApp.tsr if it's not already in the collection

If qtRepositories.Find(ObjRepPath) = -1 Then ' If the repository cannot be found in the collection
qtRepositories.Add ObjRepPath, 1 ' Add the repository to the collection

End If

End Function

No comments: