RepositoriesCollection Object
Description
A collection object that enables you to programmatically manage the run-time collection of shared object repository files associated with the current action.
IMPORTANT
At the beginning of a run session, the RepositoriesCollection object contains the same set of object repository files as the Associated Repository Files tab of the Action Properties dialog box. The operations you perform on the RepositoriesCollection object affect only the run-time copy of the collection.
You use the RepositoriesCollection object to associate or disassociate shared object repositories with an action during a run session. This enables you to perform steps on test objects that are stored in that repository without recording on the object or permanently associating the repository with the action.
For example, suppose you want to test a Web application that supports twenty different languages. Instead of creating twenty different tests (one for each supported language), you can create one test and run multiple iterations of that test—one for each language version of your application. If you create one or more shared object repository files for each version, you can use the RepositoriesCollection object to load the required shared object repository files for each iteration. Then, when each iteration finishes, you can use the RepositoriesCollection object to remove these object repository files prior to loading the object repository files required for the next iteration.
Methods and Properties
Add | Checks that an object exists. |
Count | Returns the value of the specified description property from the test object description. |
Find | Finds the index position of the specified object repository file within the run-time collection of shared object repository files associated with the current action. |
Item | Returns the path of the object repository file located in the specified index position within the run-time collection of shared object repository files associated with the current action. |
MoveToPos | Moves the object repository file entry from the current index position to the specified new index position within the run-time collection of shared object repository files associated with the current action. |
Remove | Finds the object repository that is located in the specified index position and removes it from the run-time collection of all object repository files associated with the current action. |
RemoveAll | Removes all object repository files from the run-time collection of object repository files associated with the current action. |
Add Method
Description
Adds an object repository file to the specified index position in the run-time collection of shared object repository files associated with the current action.
Syntax
RepositoriesCollection.AddRepositoryPath, [Position]
Argument | Type | Description |
---|---|---|
RepositoryPath | String | Required. The absolute or relative path of the shared object repository that you want to add. |
Position | Number | Optional. The index position to which you want to add the shared object repository in the run-time list of associated shared object repositories. If you do not specify a position, the object repository is added to the end of the list (position = -1). |
Return Value
None
The following example clears the run-time list of associated shared object repositories and then uses the Add method to add the specified object repository to that list.
RepPath = "\\MyTests\SORS\MySharedObjectRepository.tsr"
RepositoriesCollection.RemoveAll()
RepositoriesCollection.Add(RepPath)
Pos = RepositoriesCollection.Find(RepPath)
RepositoriesCollection.Remove(Pos)
RepositoriesCollection.Add(RepPath)
Window("Microsoft Word").WinObject("Microsoft Word Document").Click
Pos = RepositoriesCollection.Find(RepPath)
Count Property
Description
The number of object repository files in the run-time collection of shared object repository files associated with the current action.
Syntax
RepositoriesCollection.Count
Return Value
Read-only. A Number.
The following example uses the Count property to return the number of shared object repositories associated with the current action and to display this number in a message box.
MyObjRepFiles = RepositoriesCollection.Count
msgbox MyObjRepFiles
Find Method
Description
Finds the index position of the specified object repository file within the run-time collection of shared object repository files associated with the current action.
Syntax
Pos = RepositoriesCollection.FindRepositoryPath
Argument | Type | Description |
---|---|---|
RepositoryPath | String | The absolute or relative path of the shared object repository that you want to find. |
Return Value
A Number representing the index position in the repository collection. Index position values begin with 1. Returns -1 if the specified path is not found.
The following example uses the Find method to find the index position of the specified shared object repository in the run-time list of shared object repositories that are associated with the action. Then it uses the Remove method to remove the shared object repository from that list.
RepPath = "\\MyTests\SORS\MySharedObjectRepository.tsr"
Pos = RepositoriesCollection.Find(RepPath)
RepositoriesCollection.Remove(Pos)
Item Property
Description
Returns the path of the object repository file located in the specified index position within the run-time collection of shared object repository files associated with the current action.
Syntax
RepositoriesCollection.Item(Position)
Argument | Type | Description |
---|---|---|
Position | Number | The index position of the shared object repository that you want to retrieve from the collection. The first repository in the collection is numbered 1. |
Return Value
Read-only. A String value.
MoveToPos Method
Description
Moves the object repository file entry from the current index position to the specified new index position within the run-time collection of shared object repository files associated with the current action.
Syntax
RepositoriesCollection.MoveToPosCurrentPosition, NewPosition
Argument | Type | Description |
---|---|---|
CurrentPosition | Number | Required. The current index position of the shared object repository in the action's list of associated object repositories. Index position values begin with 1. |
NewPosition | Number | Required. The index position to which you want to move the shared object repository in the action's list of associated object repositories. Index position values begin with 1. |
Return Value
None
Remove Method
Description
Finds the object repository that is located in the specified index position and removes it from the run-time collection of all object repository files associated with the current action.
Syntax
RepositoriesCollection.RemovePosition
Argument | Type | Description |
---|---|---|
Position | Number | The index position of the shared object repository you want to remove from the list. Index position values begin with 1. |
Return Value
None
The following example uses the Find method to find the index position of the specified shared object repository in the run-time list of shared object repositories that are associated with the action. Then it uses the Remove method to remove the shared object repository from that list.
RepPath = "\\MyTests\SORS\MySharedObjectRepository.tsr"
Pos = RepositoriesCollection.Find(RepPath)
RepositoriesCollection.Remove(Pos)
RemoveAll Method
Description
Removes all object repository files from the run-time collection of object repository files associated with the current action.
Syntax
RepositoriesCollection.RemoveAll
Return Value
None
The following example uses the RemoveAll method to clear the run-time list of all associated shared object repositories before performing additional operations.
RepPath = "C:\Program Files (x86)\OpenText\UFT One\Tests\MyTest\Action1\ObjectRepository.bdb"
RepositoriesCollection.RemoveAll()
RepositoriesCollection.Add(RepPath)
Pos = RepositoriesCollection.Find(RepPath)
RepositoriesCollection.Remove(Pos)
RepositoriesCollection.Add(RepPath)
Window("Microsoft Word").WinObject("Microsoft Word Document").Click
Pos = RepositoriesCollection.Find(RepPath)
See also:
- Crypt Object
- DataTable Object
- Description Object
- DeviceReplay Object
- DotNetFactory Object
- DTParameter Object
- DTSheet Object
- Environment Object
- Extern Object
- Parameter Object
- JSON Object
- JsonUtil Object
- MercuryTimers Object (Collection)
- MercuryTimer Object
- NV Object
- OptionalStep Object
- ParallelUtil Object
- LocalParameter Object
- PasswordUtil Object
- PathFinder Object
- PDFUtil Object
- Properties Object (Collection)
- QCUtil Object
- RandomNumber Object
- Recovery Object
- Remote Connection Object
- Reporter Object
- RepositoriesCollection Object
- Repository Object
- Services Object
- Setting Object
- SystemMonitor Object
- TestArgs Object
- TextUtil Object
- UIAutomation Object
- VisualRelation Object
- VisualRelations Object
- VisualRelationsCollection Object
- WebUtil Object
- XMLUtil Object