Object repository in QTP:
Object repository is the heart of QTP, if you don’t understand it properly than you will face lots of problems in developing and testing of your application.
Please keep in mind following points regarding object repository:
– Test objects can be saved in two types of object repository
Local object repository and Shared object repository
– A local object repository stores objects in a file that is associated with one specific action, so that only that action can access the stored objects
– A shared object repository stores test objects in a file that can be accessed by multiple tests.
– When you want to create test (New project) you have two ways to store the objects in your test.
– Store the objects in corresponding local object repository OR
– Store the objects in one or more Shared object repository. (Smart ,advanced and efficient way) because it reduces maintenance and enhance reusability of your tests.
Object repository concept:
– In testing the most efficient way to save objects is in shared object repository.
– You can use the same shared object repository for multiple actions, if the actions include the same object.
– If an object with the same name is located in both the local object repository and in a shared object repository linked with the same action, the action uses the local object repository first.
– If an object with the same name is located in more than one shared object repository linked with the same action, the first occurrence of the object will be used by action.
– You can see window which is the Object Repository window (Resource->Object Repository or CTRL+R) in which you can see all objects of local and shared object repository.
– In Left side of the window, black text shows objects of local object repository
– Gray text shows objects of shared object repository.
– This figure I have taken from help of QTP, in which you can see the object detail of “buyFlights” on the left hand side.
– You can view all objects of QTP (local and shared) and you can also modify its property according to your requirements of application.
– You can copy objects from shared repository to local repository.
– This is the basic concept of Local and shared object repository if you want more detail on object repository you will find it in help of QTP.