Saturday, June 8, 2013

Repositories - Dynamic Management

One of the new feature of QTP 9.2 is Dynamic Management of OR.

>>ADD
RepositoriesCollection.Add("D:\google.tsr")
-- it will add the 'test.tsr' file during the run time

>>FIND
Pos = RepositoriesCollection.Find("D:\google.tsr")
-- it will return a numeric value to the variable 'Pos' this
is nothing but the index value of the specified file

>>MOVETOPOS
RepositoriesCollection.MoveToPos(2,5)
-- here 2 is the current index and 5 is the new index
position. In this case it will move 2nd item to 5th position

>>REMOVE
RepositoriesCollection.Remove(5)
--it removes the 5th object repository file from the OR

>>REMOVEALL
RepositoriesCollection.RemoveAll
--it removes the full items from OR. Makes object repository
empty

>>COUNT
no = RepositoriesCollection.Count
--stores the number of repository items to 'no'

>>ITEM
desc = RepositoriesCollection.Item(4)
--returns the path of the 4th object repository file.

Dim qtApp
    Dim qtRepositories
    Set qtApp = CreateObject("QuickTest.Application")
    Set qtRepositories = qtApp.Test.Actions("ActionName").ObjectRepositories
   
qtRepositories.Add "D:\Documents\sharedRepository.tsr

No comments:

Post a Comment