Blog to understand automation concepts in QTP, Selenium Webdriver and Manual Testing concepts

Object Identification in QTP - Learning Objects


During run time QTP matches the object properties it store during test preparation and perform the required action on the object identified.In this article, we will discuss how objects are identified in QTP.

Learning an Object


1. When we work on an object, QTP stores it as a test object and assign class to the object to which it belongs, For e.g: webEdit, WebElement.

2. QTP considers the mandatory identification property for the object based on the class to which the object belongs.

3. If it is not able to identify unique object in the page using mandatory properties, it adds assistive properties one by one until a unique identification is created.

4. It then adds ordinal identifier if identification properties (defined in 2 and 3) are not unique to identify object. Ordinal Identifier indexes the object based on Location, Creation time or index of the object in the page.

5. We can also define Visual relation identifier. Visual relation identifier defines an object based on relative position of the object relative to other objects in the page. For details on this, please refer QTP user guide.

6. We can also enable Smart Identification for the object in the object repository.


As explained in step 1-6 above, identification for object are created and saved in the object Repository.

An object can be learned in object Repository in following ways:

1. During recording session.

2. Using Object spy.

3. Learning from object repository Tool.


All the child objects can be learned based on the parent object using Object Spy.

Identification of object during run session:


Once we have learned the entire objects, an object repository containing all required objects is created.
During Run-session, QTP looks to identify unique object matching the object definition from object repository. Once it finds the required object, it performs action on particular object.

The object is identified during run session in following way:


1. It looks for identification properties (mandatory and assistive properties) in the run object.

2. In case more than one object matching the identification properties is found and visual relation identifier is defined, it search to identify the object using virtual relation identifier.

3. In case unique object is not found in step 1 and 2, QTP uses smart identification to identify the object.

4. In case using above steps, if object is not identified and virtual relation identifier is not defined, it looks for ordinal identifier properties.


Using above steps, QTP determines if the object is identified in QTP

Brief about Terms used:


Visual relation identifier

Visual relation identifier defines an object based on relative position of the object relative to other objects in the page.

Smart Identification

In case, QTP is not able to identify unique object based on identification properties and smart Identification checkbox is selected, it forgets learned properties and tries to identify the unique object based on Base Filter Properties and optional filter properties defined in smart identification. It searches for all objects matching the base filter properties and filter out objects based on optional filter property one by one, until a unique object is found.

Ordinal Identifier

The ordinal identifier assigns the object a numerical value that indicates its order relative to other objects with an otherwise identical description. Index, Location, and Creation time are different types of ordinal Identifier. Creation Time is browser specific only.


No comments:

Post a Comment