QTP – Object Identification

by seetaram on October 27, 2011

Every test automation tool is GUI (graphical user interface)sensitive. Test automation tool has to identify the objects on the application, then only it can do the intended operations.

QuickTest Professional has its own mechanism to identify the objects on the Application Under Test. QTP has various  add-ins available for different applications.  Let us have a look at the QTP’s object identification mechanism.

  1. Open QTP
  2. Click Tools –> Object Identification
  3. Object Identification dialog gets opened.

ObjectIdentificationMenuOption

ObjectIdenticationWindows

In QTP 9.2 standard installation, it comes with ActiveX, Visual Basic, and Web add-ins and can identify the objects of ActiveX, Standard Windows, Visual Basic, and Web applications.

QTP identifies the objects with the following properties:

  1. Mandatory properties
  2. Assistive properties
  3. Smart identification
  4. Ordinal identifier
    • Location
    • Index

IdentificationMechanism

Will get into each one of these bullet points later. Let us have look at one of the important features of QTP which will be used many times during the test automation of an application is “Object Spy”.

Open the Application Under Test (AUT)

Click Tools –> Object Spy..

objectspy

Click on the hand button on the spy

Click on a particular object on the AUTs user interface.

All the properties of the object will be displayed on this spy.

Below figures illustrate how object spy displays the object properties (Windows, Visual Basic, and Web application are taken as examples)

WindowsApp

Below are some of the important properties of an object on a Standard Windows application:

  1. Class Name
  2. attached text
  3. enabled
  4. focused
  5. nativeclass
  6. visible

When we try to spy any object on a Standard Windows Application, QTP will identify them as below:

  1. Dialog
  2. WinButton
  3. WinCheckBox
  4. WinComboBox
  5. WinContextMenu
  6. WinEdit
  7. WinList
  8. WinMenu
  9. WinRadioButton
  10. Window
  11. WinObject

These are the objects which we come across in a standard windows application. There are some more objects such as WinCalendar, WinScrollBar, etc.

Below picture shows the object spy which is having the object’s properties & Values of an Visual Basic application.

ObjectIdentifiedVB

Below are some of the important properties of an object on a Visual Basic application:

  1. Class Name
  2. enabled
  3. focused
  4. nativeclass
  5. visible
  6. Vbname
  7. Vbname path

Below are some of the objects on a Visual Basic application:

  1. VbButton
  2. VbCheckBox
  3. VbComboBox
  4. VbEdit
  5. VbList
  6. VbWindow
  7. VbListView
  8. VbFrame

As we can see in this list, every object that is identified on a VB application starts with “Vb”.

WebApplicationObjects

In the above picture, I have spied an object on a web application. Below are some of the properties which are repetitively used in web application automation using QTP.

  1. Class Name
  2. class
  3. disabled
  4. html tag
  5. innertext
  6. innerhtml
  7. kind
  8. name
  9. type
  10. value
  11. visible

While creating the test scripts we can use any one of them if the object property is unique or the combination of multiple properties if that becomes unique to identify the object.

When the objects are added to Object Repository of QTP, by default some of these properties will become Mandatory properties, some Assistive Properties. Before adding the objects to OR, we can change the settings in Object Identification and tell QTP the way we want to add the properties of the objects.

Below diagram depicts the default Mandatory Properties for WebButton:

WebButtonProperties

With these default mandatory properties, if we try to add the WeButton object on AUT, in the object repository the object contains these three properties with the Smart Object Identification enabled as the “Enable Smart Identification” check box is selected.

WebButtonPropertiesinOR

QTP identifies the objects with Mandatory properties, if the object does not contain these properties then it will go ahead with the Assistive properties. If both are absent (not added to Object Repository as they are absent for a particular object) then it uses either smart object identification (if enabled) or Ordinal Identifiers (location or index of an object).

This post covers practically how the QTP identifies objects on Standard Windows, Visual Basic, and Web Applications; what are the different types of objects; and their some of the most used properties during Test Automation exercise.

Basically, what happens during test automation is we will add objects of the AUT to the object repository. During the execution of the automated test scripts, QTP will compare the Run time properties of the objects to the one added to the object repository and then continues with the actions to be performed on the AUT.

{ 9 comments… read them below or add one }

Arun Prasad January 4, 2012 at 7:18 am

Hi Seetharam!

Awesome post:-)

Regards,

Arun

Reply

seetaram January 4, 2012 at 12:24 pm

Thanks Arun…

Reply

Sohrab Ahmad May 22, 2012 at 4:44 am

Hi seetharam

Its realy a nice post which clear all about object Identification in QTP

Reply

Manoranjan September 7, 2012 at 11:53 am

Very beautifully explained the concepts of OI ..gre8 job..
n Thanx a lot

Reply

Umang February 4, 2013 at 2:06 pm

Hi,

I want to automate the client central application. The QTP is not able to identify objects in it. Please help me out.

Thanks,
Umang

Reply

seetaram August 26, 2013 at 6:16 am

Post more about your application and try using other automation tools such as TestComplete

Reply

keerti February 22, 2013 at 6:22 am

Very nice.. post.

Reply

Rashmita March 18, 2013 at 11:04 am

Very useful for bigner

Reply

Rahul September 3, 2014 at 1:02 pm

Very nice explanation.
Thanks

Reply

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