All You Need to Know about Local And Shared Object Repository in UFT

Object Repository is a collection of Test Objects and object properties with which UFT/QTP will be able to recognize the objects and perform the desired action on it. When a user records a test, the objects and their properties are captured by default. If later on the object property gets changed, UFT won’t be able to identify the test object and will through an error message at runtime.

In this tutorial, you will learn the following things:

Types of Object Repository

There are two Types of Object Repository in UFT

  • Local Object Repository
  • Shared Object Repository

Local Object Repository in UFT

As the name suggests, it is specific to actions and can be used only for a particular action. If there are multiple actions in a test there would be a local object repository for each action. Local Object repository cannot be reused in any other action. You can open a local object repository by navigating to “Resources>Object Repository“.
The local object repository window will be displayed.
You can also perform other operations like add an object, delete an object, and locate an object, etc. Just hover your mouse on the icons available and you will easily get to know their functions.

Shared Object Repository in UFT

The shared object repository is a standalone external file that can be associated with the required actions of any test. There are two ways to create a shared object repository.
  • Exporting local objects
  • Using Object Repository Manager

Exporting Local Objects

Open the local object repository by navigating to “Resources>Object Repository“. In the Object Repository window click on “File>Export Local Objects.
Shared Object Repository in UFT
Browse the required location and provide the name of the object repository and click on the Create button. Local object repository will be exported into a .tsr file that you can associate with any action in a test.

Using object  repository manager

Go to Resources>Object Repository Manager.

Object Repository Manager window will open.
Click on the + icon to add objects to the object repository manager window. The mouse cursor will be turned into a hand icon. Click on the object that you want to add to the shared objective and press the OK button.
The object will be added to the object repository manager.
Repeat the above steps to add all required objects. When you are done with adding all required objects go to File>Save As to save the objects in a shared object repository file.

Associate a Shared Object Repository with an Action

Again as the name suggests, it’s a shared object repository and can be associated across actions in a test. Now you already know how you can create it. To associate a shared object repository with an Action follow the below steps.
Go to “Resources>Associate Repositories“.Associate Repositories will be opened. Click on the + icon to browse the required shared object repository file.
If you have multiple actions in your test, all available actions will be displayed to associate it with the shared object repository. Select the required action with whom you want to associate the object repository and click the right arrow to move it to the Associated Actions list. I am associating the object repository with Action1 only. Click the OK button.

Difference between Local and Shared Object Repository

The following are the major differences between the Local and Shared object repository.

Local Object Repository Shared Object Repository
It is by default available to each test. It has to be associated with the required action.
It is available one for each action. It can be associated with multiple actions of multiple tests.
Local Object Repository is editable in Object Repository. It is read-only by default. However, it can be edited using Object Repository Manager.
It is saved with an extension .bdb It is saved with an extension .tsr

When to use Shared object repository

  • It should be used when there are different scripts interacting with the same objects.
  • Shared objects Repository is usually used in real-life automation projects where multiple people are working in automation script development and they have to interact with common test objects. If the property of an object is gets changed in the future it is updated at only one location that is the shared object repository and changes are reflected in each script.

Recommended Posts

Leave a Reply