Monday, January 25, 2016

Repository Collection Object in QTP/UFT:

Repository Collection Object is used to manage Shared Objects Repository files at run time.
It has following methods and properties.
Methods: Add , Find , MoveToPos , Remove , RemoveAll
Property: Item , Count
----------------------------------------------------------------------------------
Add
Description: Add method is used to add an object repository file to the specified index position at run time with the current action.
Syntax: RepositoriesCollection.Add (RepositoryPath)
Return Type: None
Example: Dim Rep_Path
Rep_Path = “C:\Repository.tsr”
RepositoriesCollection.Add (Rep_Path)
-------------------------------------------------------------------------------------------
Find
Description: Find method is used to get the position of the specified object repository file at run time associated with the current action.
Syntax: RepositoriesCollection.Find(RepositoryPath)
Return Type: A Number
Example: Dim Rep_Path, Position
Rep_Path = “C:\Repository.tsr”
Position = RepositoriesCollection.Find (Rep_Path)
------------------------------------------------------------------------------------------
MoveToPos
Description: MoveToPos method is used to change the position of object repository from current index position to new index position.
Syntax: RepositoriesCollection.MoveToPos(Current_Position,New_Position)
Return Type: None
Example: Dim Rep_Path, Current_Position, New_Position
Rep_Path = “C:\Repository.tsr”
RepositoriesCollection.MoveToPos (Current_Position,New_Position)
------------------------------------------------------------------------------------------
Remove
Description: Remove method is used to remove the object repository files from the current action.
Syntax: RepositoriesCollection.Remove(Position)
Return Type: None
Example: Dim Rep_Path, Position
Rep_Path = “C:\Repository.tsr”
Position = RepositoriesCollection.Find (Rep_Path)      ‘Find the position of the Object Repository.
RepositoriesCollection.Remove (Position)
-----------------------------------------------------------------------------------------
RemoveAll
Description: RemoveAll method is used to remove all the object repository files from the current action.
Syntax: RepositoriesCollection.RemoveAll
Return Type: None
Example: Dim Rep_Path
Rep_Path = “C:\Repository.tsr”
RepositoriesCollection.RemoveAll
--------------------------------------------------------------------------------------
Count
Description: Count Property is used to get the number of object repository files from the current action.
Syntax: RepositoriesCollection.Count
Return Type: A Number
Example: Dim Var_Count
Var_Count = RepositoriesCollection.Count
-----------------------------------------------------------------------------------------
Item
Description: Item Property is used to get the path of object repository file based on the specified position from the current action.
Syntax: RepositoriesCollection.Item(Position)
Return Type: A String
Example: Dim Var_Path

Var_Path= RepositoriesCollection.Item(Position)

No comments:

Post a Comment