How Object Identification works in UFT/QTP (Advance Concepts)

Introduction

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

2) Text

3) URL

How UFT uses Mandatory and assistive properties?

While recording

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.

At run-time

  • 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.

Ordinal identifiers

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

Index

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.

Location

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.

Location:=4

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

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.

Base Filter

Again, Base filter properties defines the core essence of the object and these are the most fundamental properties of the object.

Optional Filter

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

Object Identification Flow

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.

Thanks,
Sumeet Singh Kushwah

Advertisements

4 responses to “How Object Identification works in UFT/QTP (Advance Concepts)

  1. Pingback: How and when to set Mandatory and assistive properties in UFT/QTP? | Automation Insights·

  2. Pingback: Object repositories in UFT | Automation Insights·

  3. Hi Summit, I have read your blog, this is really good to learn lot of things for UFT and LeanFT.

    I am facing one issue in UFT, Hope you will help me for the same.

    I was unable to identify the some of the objects in my web application. Then I have started reading the HTML code of that application. In that I came to know, They have used another html code inside a frame inside one html.

    So the hierarchy goes like this as per html code
    HTML>Body>Div>Div>P>Frame>HTML>Body

    so whatever the object inside the another html code is identifying as a winobject for me. rest of the objects are working and identifying properly.

    Can you help me in any way, it would be very helpful

    Thanks in advance

    Like

    • Hi Paul,

      1) Have you tried using the Descriptive programming to find the childobjects under the frame object ?
      2) Have you tried enabling the use of XPATH in UFT ?

      I tried recreating the scenario, but UFT was able to identify the objects.

      Can you send me the source code for the html page with issues ?

      Thanks,
      Sumeet Singh kushwah

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s