QTP – Introduction to Object Repository (OR)

by seetaram on October 2, 2011

When the test steps are recorded using QTP, it captures the objects (properties & methods) and stores in a separate file called object repository (OR). Later this is referred in the script.

In the previous post, we have recorded an end-to-end test scenario and executed the script successfully. Let us have a look at the object repository of the same script.

Open QTP and then Click File –>Open to open the saved Insert Order script.

How to open the Object Repository:

  1. Click on the Object Repository shortcut
  2. Click Resources Menu –> Object Repository (ctrl+R)

ObjectRepository1

ObjectRepository2

As shown in the above figure, open the object repository of the script and it should look like as in the below picture.

ObjectRepository3

In the OR, we can see all the objects which are used in the script (i.e. Dialog, Window, WinMenu, WinComboBox, etc). We can see the name of the object and the respective icon.

On the right side of the object repository we can see the Object Properties (Test Object Details).

Let us have a look at the properties of some of the objects:

Login Dialog:

  • text
  • nativeclass
  • is owned window
  • is child window
  • Ordinal Identifier – None
  • Additional Details – Enable Smart Identification – False

We will discuss Ordinal Identifier and Smart Object Identification later.

OK Button:

  • text
  • nativeclass

Agent Name Edit box:

  • nativeclass
  • attached text

Flight Reservation Window:

  • regexpwndtitle
  • regexpwndclass
  • is owned window
  • is child window

When we use QTPs recording engine to record the test steps, there is absolutely no need to even look at the object repository. After the record, QTP generates the code as well as creates a local object repository. But if we want to add only the objects we need to the object repository and use them in the scripts that we create, then understanding the OR is absolutely necessary. This is just an introduction to Object Repository, we will have details of the types of Object Repositories, how to add objects to the OR, merging OR, editing the OR, etc in the future posts.

Leave a Comment

Previous post:

Next post:

Do you want to get updates on the recent articles written? Please subscribe to RSS feed or Email