Software Testing Learning Hub

Object Repository in QTP

Object Repository is an important concept or core function in QTP. all Actions in QTP performed on the basis of Objects. For each test object you select in the tree, the Object Repository window displays information on the test object, its type, the repository in which it is stored, and its test object details. Object is nothing but the uniquely identified windows handle by which we can able to identify the object ( like textbox, textarea, menulist, anything running on windows machine).

When we record the script, QTP automatically identify the objects and stored them in Object Repository (OR). so while running the Script. these stored objects find the respective windows handle and perform action on it as per the script.

 Advantages of Object Repository

  • It Simplifies the test script by allowing to separate physical attributes from the test scripts
  • Automatically identify the the unique properties of test object and stored it
  • Allow to rename the OR objects to meaningful text for easy to use.
  • automatically identify the changes in test object and suggest modification.
  •  Readability of scripts is improved with the usage of Names
  • Use the same script with different Object Repository for each platform

Object Repository is a collection of objects pertaining to the application under test.

Example: All the text boxes, list boxes, images etc are stored in a file in QTP. This file is called as object repository.

QTP  identifies objects in your application based on a set of test object properties. It stores the object data it learns in the object repository. You can save your objects either in a shared object repository or in action object repository. In shared object repository mode, you can use one object repository file for multiple tests or components. In object repository per action mode, QTP automatically creates an object repository file for each action in your test. Object repository per-action mode is not available for components

We can have any number of Shared Object Repositories associated with an action. In QTP 10.0 all the objects are recorded into the local repository and then we need to export the objects from local repository into the shared object repository by opening the object repository and selecting File Menu and selecting “Export Local Objects”.

We need to specify the name for the shared object repository in which we want to save these objects.

QuickTest has two types of object repositories for storing object information:

1. Shared object repository
2. Local object Repository

Shared Object Repository:

A Shared Object Repository(SOR) stores objects information in a file that can be accessed by multiple Test.Extension of file name is .tsr,This is the most familiar and efficient way to save objects.

Local Object Repository:

Local Object Repository stores objects information in a file that is associated with one specific action, so that only that action can access the stored objects.Extension of file name is .mtr.