QTP uses three different types of properties when identifying a object based on pre defined object identifications.
Mandatory Properties – Primary properties defined for the specified object, always check these properties exist else it goes to Assistive Properties
Assistive Properties –If Mandatory Properties are not enough to identify the object then assistive properties will help QTP to identify the object (Defined in object identification)
Ordinal identifiers –If both Mandatory and Assistive Properties are not enough to identify the object then QTP uses ordinal identifiers, it has three types, Index(0,1,2..), Location(x,y positions) and Creation time(8.PM)
How to do object identifications in QTP?-settings
From Tools Menu select ->Object Identification, Object Identification dialog opens as seen in the below snapshot
In the above snapshot for standard windows Environment, Win button Class Mandatory Properties are “native class” and “text” as seen in above , for a win button if these two properties are insufficient to find out the object then with help of assistive properties (in the above example “window id”) QTP recognizes the objects
For a win button class “native class” and “text” are default properties, at any instant either you can add or remove the properties, same can be done for assistive properties.
In the above snapshot, from left side, click User defined button to get user defined object mapping dialog, in this dialog user can define their own class name and for which properties it belongs to.
To map an unidentified or user defined class to a standard window class objects.
In the object Mapping dialog click the pointing hand and then click the object whose class want to be added as a user defined class, name of the custom object is displayed in the class name pack, in the map to package/box, select the standard object class to which the custom object class has to be mapped and click Add button, To map additional objects to standard classes, repeat steps 4-5 for each object, then click ok button, object mapping dialog box closes and the object is added to the list of standard windows test object classes as a user defined test object, Configure the object identification settings for the user defined object class just like any other object class.
Smart identification in QTP?
QTP has a feature Smart identification or smart recognition, it generally identifies an object by matching it’s test object and run time object properties, it may fail to recognize the dynamic objects whose properties change during run time, hence it has an option of enabling smart identification, where it can identify the objects even if their properties changes during run time execution.
Ex. If QTP is unable to find any object that on comparing object description, or if more than one object fits the description, then QTPdisregard the recorded description and uses the smart identification mechanism to try to identify the objects, while the smart identification mechanism is more complex, it’s more flexible and thus if configured logically, a smart identification can probably help quick test identify an object if it’s present, even when the recorded description fails.
Smart identification properties
Base filter properties –Values cannot be changes without changing the original object
Optional filter properties –With the help of other properties QTP identifies the particular class, suitable when objects are dynamically changes.