QTP – Object Identification

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.

Comments 9

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.