Working with objects in multiple associated repositories with the same name (QTP 9.0)

Working with objects in multiple associated repositories

If an object with the same name and description is located in both the local object repository and in a shared object repository associated with the same action, the action uses the local object definition. If an object with the same name and description is located in more than one shared object repository associated with the same action, the object definition is used from the first occurrence of the object, according to the order in which the shared object repositories are associated with the action.

Note:
QuickTest Professional will not generate an error when multiple repositories containing objects with the same name are associated with the action.

Example:
You have the following webpage:

<html>
<body>
<table>
<tr>
<td><a href="http://www.google.com">Google</a></td>
<td><a href="http://www.google.com">Google</a></td>
<td><a href="http://www.google.com">Google</a></td>
</tr>
</table>
</body>
</html>

1. Learn the first link into one shared repository, shared1.tsr.
2. Learn the second link into a different shared repository, shared2.tsr.
3. Learn the third link into the action’s local repository.

Each repository should now contain a Google object. The object hierarchy and name for each link will be the same (the objects are uniquely identified by the index identifier property).

4. Associate the shared1.tsr repository, then the shared2.tsr repository to the action. The associated repository list should look like the following:

<local>
shared1.tsr
shared2.tsr

5. In your script, enter the following line:

Browser("Browser").Page("Page").Link("Google").Highlight

6. Run the script. The third Google link will highlight. This is the link in the Local repository.
7. Remove the Google link from the local repository.
8. Run the script. The first Google link will highlight. This is the link in the shared1.tsr repository.
9. In the Keyword View, right-click on the Action and select "Action Properties".
10. Select the Associated Repositories tab.
11. Select the shared1.tsr file in the list, then click the down arrow button. The associated repository list should now look like the following:

<local>
shared2.tsr
shared1.tsr

12. Click <OK> to close the Action Properties window.
13. Run the script. The second Google link will highlight. This is the link in the shared2.tsr repository.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s