Object identification in UFT goes through four sequential stages. If in any of the stage, a unique object is identified, it won't go to the remaining stages.
Mandatory Properties -> Assistive Properties ->
Visual Relation Identifier->Smart
Identification --> Ordinal Identifier.
Object Identification Process :
UFT performs the operation only after identifying the object uniquely. In order to identify the object uniquely it uses property values of the respective object which will be stored in the Object Repository.
Each object has many property values, storing all the property values of the values of the object not only consume more space and also reduces the performance of QTP. In order to solve this QTP stores minimum property values based on the Object Identification settings. Object Identification process has following sections:
Mandatory Properties:
During recording first QTP goes to the Mandatory Property section of the respective object type and reads all the mandatory property values of the object from the application if they are sufficient then it will stop the object identification or else QTP will go's to the assistive properties.
Assistive Properties:
QTP reads the assistive property (non mandatory) values one by one, if it is sufficient then it will stop the object identification or else QTP will go to visual relation identifiers if we defined.
Visual Relation Identifiers :
In this stage, UFT checks if Visual Relation Identifiers (VRI) are defined. VRI is a set of definitions that enable we to identify the object in the application according to the relative location of its neighboring objects.
Note : Now if a unique object is identified, the flow is complete. VRI was not defined OR several/none of the objects get identified using VRI, the object identification process is handled by the next stage.
Smart Identification :
UFT checks if Smart Identification is defined and enabled.
Smart Identification is an object identification mechanism wherein UFT uses a combination of fundamental properties of a test object class and some optional properties to identify an object.
Again, if a unique object is identified, the flow is complete. If a unique object is still not identified then object identification process is handled by the next stage.
Ordinal Identifier:
This is the last stage of object identification process. In this stage, UFT checks whether ordinal identifiers are defined.
Ordinal identifier assigns the object a numerical value that indicates its order relative to other objects with an otherwise identical description.
- Location
- Index
- Creation Time
Location: It is the sequential number like 0, 1, 2….. generated by QTP based on the order in which object appears on the application. QTP starts the scanning process from LEFT top corner of the application and it will scan every column from left to right. In this scanning process the first Objects gets the location value 0 then the next object will get the location value 1 and so on.
Example:
The value of location for the group of text boxes will be as follows:
Note: Location value for objects is generated only for the objects that are having the same Mandatory and Assistive property values.
Index: It is the sequential number generated by QTP based on which the object appears in the source code.
For the same example the value of index for the group of text boxes will be as follows.
Creation Time: It is the sequential number generated by QTP based on the time the when the browser was launched. This means that the browser that is launched first will get the creation time as 0 and the second browser that is launched will get the creation time as 1.The third browser will have a creation time of 2 and so on.
Example:
SystemUtil.Run "iexplore.exe", "http://www.gmail.com" 'this will get CreationTime 0
SystemUtil.Run "iexplore.exe","http:// www.ksrtc.com" 'This will get CreationTime 1
SystemUtil.Run "iexplore.exe","http://www.irctc.co.in" 'This will get CreationTime 2