Long back (
April, 2009) I have explained about
Object Repository in QTP.
In this post I will explain
various types of Object repositories (OR).
If you are not familiar with Object repository, read this post after reading my
previous post.
And, 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.
They are,
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. (I will explain about Object Repository Manager later with video. You can
subscribe to get them in your inbox.)
We can export the local object repository objects into the Shared Repository file.
Associating Repositories
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.
More Articles...You can
bookmark this blog for further reading, or you can subscribe to our
blog feed.