RSS Feed

QTP’s Object Identification Paradigm – How QTP Identify Objects Uniquely?

QTP Tutorial #7 – QTP’s Object Identification Paradigm – How QTP Identify Objects Uniquely? — Software Testing Help

We are getting ourselves equipped with all the basic concepts that will enable us to write robust QTP tests. We have covered the QTP record and run settings, working with keyword view and the other related topics.

This is the next article in the series that talks about a crucial aspect of QTP – The mechanism it uses to identify an object uniquely.  When you look at the below screen:


There are 3 buttons and 2 text boxes along with various other elements in this dialog.

In the previous examples, when we entered the user name and password we saw how QTP recorded the same operations in terms of programmatic code as well as a table in keyword view. Now, during play back how does QTP know that the value we provide as Agent Name or Password has to go respectively in those edit boxes. Or how does it know which button to click to submit the values entered?

Let us try to find an answer to that.

It is clear that QTP somehow remembers which object to act on. The way it does it is, it stores the object in the AUT as a test object. It then examines its properties and classifies the object. For E.g.: when it encounters the OK button it examines its properties and based on these, it classifies the object as a ‘WinButton’.

QTP has a predetermined set of properties that it learns/stores for every class of object it identifies. There are 3 aspects to this:

Mandatory properties: This is the list of properties for a certain class that QTP always stores. We could say that this is the object description. It also checks this in conjunction with the parent object to see if the description is sufficient to identify the object uniquely.
Assistive properties: In case the description of mandatory properties is insufficient to identify the Object a set of non-mandatory properties will be added to the description one after the other until there is enough data to identify the object.
Ordinal Identifier: If the assistive properties also do not result in unique identification of an object a special ordinal identifier is added by QTP, such as the object’s location on the page or in the source code.
So, this is how QTP forms Test Objects. It uses this Test Object description to search for the objects to act on during a run session. It chooses the objects that match perfectly with the description it contains. These objects are called Run-Time objects.

Unless your application has changed significantly the Test Object description that QTP has is sufficient to find an object.

For the WinButton object that we have in our Flight app, let us see what properties QTP has stored. This information is available in the Object Repository. Menu option “Resources->Object Repository” will launch the OR for us. Alternately, you can use CTRL+R or click on the icon.


If you notice in the above window, it stored the ‘text’ in the WinButton as its description to identify this button at runtime.

For more complicated applications, the tester can add or remove certain properties to make the description robust enough to identify the object at runtime more precisely. To do this, simply click on the ‘+’ icon.


All the other properties of the object will be displayed. The user can choose to add one or more of these properties.

There is also something called “Visual Relation Identifier” in the OR screen for the WinButton properties.

This is a feature that further supports the object recognition according to their neighboring objects in the AUT. Once set, this creates a kind of link for the less stable components in your AUT with the objects that are more uniquely identifiable. QTP will identify these objects as long as they maintain their relative position to these unique objects.

To set a kind of positional link we are going to have to click on this column in the OR and the following screen comes up:


In this screen select the ‘+’ sign to add an object with which you want your test object to have a positional link.

I will choose “Agent Name” and say that this object should be above “OK”button.

This is how I set that:


Now, in case some properties of OK button changes in the future, QTP will identify it if, “Agent Name” is above it.

Smart identification:

This is the mechanism employed by QTP under one of these two situations. The description for an object that QTP has:

does not match with any run time objects
Matches with multiple objects
This is a little bit of an advanced concept, so we will get to it at a later time via some example for easy and elaborate understanding.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: