UFT is a test automation tool and in terms of UFT, every control or window visible on the screen is an object. To Build/execute the automated tests, UFT will need a way to create the unique object description (properties with value) for storing the object descriptions to the files (Object repositories), and identify these objects during execution for performing the desired operations on them.
Let’s consider an example, you are writing a letter to your friend, can you post that letter without an address, or can you post the letter, if you know that your friend lives in Florida. The answer is no, you need a full address – a city, zip code, locality and country. Why? Because your friend’s house (Object) cannot be identified without a unique address (properties).
The major issue people face in the identification of objects of that different application need different approaches for the creating the unique identification properties.
If I have two text boxes on the screen with different names then I can use name for the identification of the object, but what if we have objects with same name, then I need to find some other property. If there are no other property then I will have to rely on the Visual relationship between the objects or ordinal index.location identifiers(don’t worry if you don’t know what it is, we are going to see it in detail soon).
Let’s discuss the different methods UFT will use for identifying the objects.
There are four different methods UFT will use to generate the unique identification while recording the objects or executing the scripts.
UFT identification methods
Mandatory and Assistive properties
Mandatory properties, represents the core object properties of the object, lets consider the Link Object, which can be obtained using the tag name “a” and “text”. So the core essence of the object can be created using these two properties.
Assistive properties are the properties which will be used for the identification of the objects if the mandatory properties are not enough for the identification of the object.
We can configure these two properties separately, but they will always be used together.
Let’s consider the same example of the Links, if we have the two separate links with the same text but different URL’s and if the URL is the assistive property, then while recording the objects, we will have the following properties in the object repository for this object
1) HTML Tag
How UFT uses Mandatory and assistive properties?
When we try to add an object to the object repository, UFT follows the following procedure
1) Fetch all of the mandatory properties of the object and check if the unique object description can be created. If not then, continue to step 2.
2) Add one assistive property at a time to the object repository and try to create a unique object description.
3) if unique description cannot be created then, UFT will use the ordinal identifiers for creating the unique identification description. Ordinal identifiers are explained later.
- Once the properties are added to the object repository, it is required for UFT to use all of the added properties to create a unique identification description. So, it’s important to understand that, at run time UFT cannot differentiate between Mandatory or assistive properties.
- If UFT founds no/more than one object then unique description is created using visual relationship identifiers (if defined) or by using smart identification (if enabled). We will discuss about then in detail later in this post.
- If UFT finds no/more than one object and unique description cannot be created using Smart Identification, then it uses ordinal identifiers for the identification of the objects. What’s important and missed by many articles is that Ordinal identifiers will not be used by UFT if the unique object can be created using the Mandatory and assistive properties. Ordinal Identifier will only be used if VRI is not used.
Now, you have a basic understanding about the mandatory and assistive properties, so open object identification dialog box and check the identification properties for couple of web objects.
So, the most important thing to be considered is that when you update how the object should be identified using UFT, add properties in the assistive properties, this will make sure that UFT uses a just the required properties for the identification of objects.
As, discussed in the previous section, ordinal identifiers are used by UFT to create a unique identification description, if unique description cannot be created using mandatory or assistive properties.
Ordinal identifiers are the indexes of the objects with respect to mandatory and assistive properties at design time and objects Object repository properties at run-time.
Let’s take the same example
If we have two link objects on the screen, with same text and URL, then we can use the ordinal identifiers to identify one of the objects.
Types of Ordinal identifiers
It is the order in which the object appears in the application code. So if a developer creates a “submit” button first and then “check” button, although if “check” button appears on the screen first but the index for the button will be 1 and index for the submit button will be 0.
It is the location of the object, you might have heard this a lot of time, but if you ever try to look closely, then you will figure out that we wont give x,y co-ordinates of the object there, but we will provide just one number.
So, what the difference between the Index and the Location ?
Index is the order, developers have coded the controls inside the application and Location is the order in which it appears on the screen.
Creation time is only used for browsers, mainly because we might be opening multiple browsers during executions.
Creation time will be assigned to the browsers as you will open the browser, so the first browser you will open after opening UFT will have creation time of 0 and then 1 and so on.
Now lets try opening a browser before UFT, and use object spy for identifying the objects. UFT will fail to identify the browser and object spy will display window object as browser object.
So now, just close the browser and open it again, now UFT will identify the browser and provide the creation time as 0 to it.
What is Smart Identification?
If at run time, UFT is unable to identify the object using the Mandatory and Assistive properties, or if UFT finds multiple objects, then UFT will try to use the smart identification.
Smart identification is the set of properties, defined within UFT for each object. If configured logically then, Smart Identification can be very useful in the identification of the objects in the Dynamic applications. Just like Mandatory and assistive properties, there are two set of properties which can be configured within smart Identification. They are Base Filter and optional filter.
Again, Base filter properties defines the core essence of the object and these are the most fundamental properties of the object.
These are the set of other properties which can help in the object identification.
Smart Identification process
- UFT forgets the object identification created using the Mandatory and assistive properties.
- UFT creates the new Object lists with the all of the properties defined in the Base Filter.
- If there is more than one object, then UFT will start using the optional filter properties to filter the objects out. UFT will try to use this filtering method to create the unique description of the object.
- If unique object can be created then, UFT will use that for the object identification. But if, unique object cannot be created then, UFT will discard these learned smart identification objects list and use the object list created with Mandatory and Assistive properties with Ordinal identifiers to identify the object.
Now the important thing to be remembered is that, Smart identification does not work in Sync with the Mandatory and Assistive properties and hence, it can just identify the wrong controls and produce the undesired results.
Visual Relation Identifiers (VRI)
Visual relation Identifiers is a new and unique way of identifying an object using the location, relation and the distance from the other object.
VRI, sits in between Mandatory/Assistive properties and Smart Identification, so if VRI is defined and UFT is unable to create a unique description for the object using mandatory and assistive properties then, it will use the VRI first to create the unique Object description, if UFT is unable to create the Unique description using the VRI also then UFT will switch to smart identification. If VRI is defined then ordinal identifiers will not be used.
Unlike Smart identification VRI will work in sync with the Mandatory and assistive properties, so VRI will first create the list of objects identified using Mandatory and assistive properties and then use the visual identifiers to create the unique object description.
What’s the important point here? VRI will only work If, Mandatory and assistive property combination identifies one or more objects. Also if VRI is defined, the ordinal identifier will not be used, even if VRI is failed.
Examples of the some relationship details
- ‘Object1’ is to the Left of ’Object2’
- ‘Object1’ is to the Right of ‘Object2’
- ‘Object1’ is above and vertically in line with the ‘Object2’
- ‘Object1’ is the closest object on the y-axis to ‘Object2’
*Where Object2 is to be identified in relation with Object1
You can also define relationship with the multiple objects
- ‘Object1’ is to the Left of ’Object2’
- ‘Object3’ is to the Right of ‘Object2’
Below is the consolidated flowchart for everything we discussed above
Couple of important things to remember
1) If web object identifiers are used, then they will take precedence over the normal flow of object identification.
2) UFT generated properties like Source Index(Tools ->Options ->GUI testing->Web->Advanced), will also affect the object identification properties.
We will discuss in detail about each of the 4 methods, in the upcoming articles.
Let me know, if you have any questions.
Sumeet Singh Kushwah