UFT/QTP – Object Identification

UFT performs actions on the objects of an application by learning and identifying the objects in the application. The Process of uniquely identifying an object from the application is called as object identification.

UFT uses two modes of object identification to recognize the objects uniquely.

  • Normal Identification
  • Smart Identification

Normal Identification – This is a default object identification mode in this mode UFT has two list of properties based on which it will identify the object. First list is the mandatory properties. UFT learns these default properties values and checks if any object matches the description. If object not found uniquely in the application  it adds properties from the second list called as assistive properties. Assistive properties added one by one till an unique object is not identified.

“Mandatory properties are properties that UFT always learns for a particular test object class.”

Assistive properties are properties that UFT learns only if the mandatory properties are not sufficient to identify unique object

If both properties are failed to identify unique object, UFT uses ordinal identifiers to identify the object uniquely.

Ordinal Identifiers –  There are three types of ordinal identifiers:

  • Index – this identifier indicates the order in which the object appears in the application. This order is unique even though identical objects are present.
  • Location – this identifier indicates the order in which the object appears within the window, frame or dialog box irrespective of objects with identical description. Values are assigned from top to bottom, and then left to right.
  • Creation time – this identifier is only for web application for identifying the browser to be worked on when a group of identical browsers are open. Identifier indicates an unique id in the order in which the browser were opened.

Steps to configure mandatory and assistive properties –

Step 1 – Select “Tools > Object Identification”, Object Identification dialog box opens as shown below

QTP Object Identification Box

Step 2 – Select the appropriate environment in the Environment list.

Step 3 – Select the test object class from the Test Object classes list which you want to configure.

Step 4 – Click Add/Remove button from the Mandatory Properties list, add/remove dialog opened select the properties which you want to include. Click OK to close the dialog box.

Note – you can also add new properties by clicking New button.

QTP Object Identification Mandatory Properties

Step 5 –   Click Add/Remove button from the Assistive Properties list, add/remove dialog opened select the properties which you want to include. Click OK to close the assistive property dialog box.

QTP Object Identification Assistive

Step 6 –  use the up and down arrows to set your preferred order for assistive properties. Click OK to close the dialog box.

Smart Identification – When normal identification fails to identify an unique object, UFT switches to the next identification called smart identification. Smart Identification must be enabled for the test in UFT.

The Smart Identification uses two lists of properties:

  • Base Filter Properties – This list of properties contain the most fundamental properties of a particular test object class whose values can not be changed without changing the original object.  for example if web link’s tag was changed from  <A> to any other value, you could no longer call it a web link.
  • Optional Filter Properties –  Other properties that can help identify objects of a particular class as they are unlikely to change on a regular basis, but which can be ignored if they are no longer applicable.

Understanding the Smart Identification Process

Step 1 – UFT “forgets” the recorded test object description and creates a new object list containing the objects that match all of the properties defined in the base filter property list.

Step 2 – From that list of objects, UFT filters out any object that does not match the first property listed in the Optional Filter Properties list. The remaining objects become the new object candidate list.

Step 3 – UFT evaluates the new object candidate list:

  • If the new object candidate list still has more than one object, UFT uses the new object candidate list to repeat step 2 for the next optional filter property in the list.
  • If the new object candidate list is empty, UFT ignores this optional filter property, returns to the previous object candidate list, and repeats step 2 for the next optional filter property in the list.
  • If the object candidate list contains exactly one object, then UFT concludes that it has identified the object and performs the statement containing the object.

Step 4 – UFT continues the process described in steps 2 and 3 until it either identifies one object, or runs out of optional filter properties to use.

If, after completing the Smart Identification elimination process, UFT still cannot identify the object, then UFT uses the recorded description plus the ordinal identifier to identify the object.

If the combined recorded description and ordinal identifier are not sufficient to identify the object, then UFT stops the test run and displays a Run Error message.

Steps to configure smart identification properties

Step 1 – Select “Tools > Object Identification”, Object Identification dialog box opens as shown below.

QTP Smart Object Identification

Step 2 – Select the appropriate environment in the Environment list.

Step 3 – Select the test object class from the Test Object classes list which you want to configure.

Step 4 –   Click the configure button next to the enable smart identification option is selected. The Smart Identification properties dialog box will shown as below –

QTP Smart Object Identification Dialog

Step 5 – In the base filter properties list click Add/Remove button, add/remove dialog box for opens. select the properties which you want to include in the base filter properties. Click OK to close the dialog box.

QTP_Smart_Object_Identification_Base_PropertiesStep 6 –   Click Add/Remove button from the Optional Filter Properties list, add/remove dialog opened select the properties which you want to include. Click OK to close the Optional Filter Properties dialog box.

QTP_Smart_Object_Identification_Optional_Properties

Step 7 –  use the up and down arrows to set your preferred order for Optional Filter Properties. Click OK to close the dialog box.

Custom Object  – If the application under test contains objects that do not belong to a particular class type, such objects are recorded  as WinObjects and are called as custom objects.

Such objects can be mapped to an existing standard class while mapping remember that the custom object behavior to comparable to the standard class being mapped to.

Steps To map custom class to a standard Windows class:

Step 1 – Select “Tools > Object Identification”, Object Identification dialog box opens as shown below.

QTP_Custom_Object_Identification

Step 2 – Select Standard Windows in the Environment list. The User-Defined button becomes enabled.

Step 3 – Click User-Defined. The Object Mapping dialog box opens as shown below.

QTP_Custom_User-Defined_Box

Step 4 – Click the pointing hand and then click the object whose class you want to add as a user defined class. The name of user defined object is displayed in the class name box.

Step 5 – In the map to box, select the standard object class to which you want to map and clack add. The class name and mapping is added to the object mapping list.

Step 6 – Click OK. the object mapping dialog box closes your object is added in the list of standard windows test object classes as a user-defined test object.

Leave a Reply

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