In this Chapter I will explain various types of Object repositories (OR).
You should be familiar with “What is Test?” and “What is Action?” in QTP for understanding the types of object repositories.
There are two types of Object Repositories available in QTP.
1. Local object Repository (Previously it was called as per-action)
2. Shared Object Repository.
Local Object Repository
Local Object Repository stores Test Objects in a file associated with each Action. i-e Each action will have its own local object repository.
These objects can be edited from the corresponding Action.
This local object repository can NOT be used and/or edited by any other Actions within the same Test.
You can see separate ObjectRepository.bdb file inside each Action sub folder within the Test folder when you see them thro’ windows explorer.
The local object repository will be created automatically and the Test objects will be automatically stored in the Local repository while doing recording.
Shared Object Repository
A shared object repository stores test objects in a file( normally .tsr file) that can be accessed by multiple Actions/Tests in read-only mode.
We need to create this Shared Object Repository manually from Object Repository Manager.
We can export the local object repository objects into the Shared Repository file.
Each Action can use the objects from local object repository and from multiple shared object repositories.
Association of Object repositories can be done easily from the “Associate Repositories” Dialog window which will be opened from Tools->Associate Repositories menu in the Object Repository window.
By storing objects in shared object repositories and associating these repositories with Actions/Tests in your Test, you enable multiple Actions/Tests to use the objects.
It will improve maintenance of the script.
Since each Action is allowed to take objects from many places (Local object repository and multiple Shared object repositories), you should know how QTP will handle if object with same name is located in more than one repository.
QTP will give high priority to the local object repository. It will use the object from the Local object Repository if it finds object with same name in many repositories.
And, if more than one shared object repositories are having same object (i-e object with same name, properties may vary), QTP will use the object based on the order of association.
Since the shared object repository improves maintenance and enhances the re-usability, we should use them in our Automation project.
Local object repository can be used for learning purpose. Since they are getting created automatically, it will be easy to use for the beginners.