In the last tutorial we discussed at length about Classes, Objects, Properties and Methods in UFT. Towards the end of that tutorial we discussed about Object Spy. There are a couple of radio buttons in Object Spy interface which are marked as Native and Identification. People often get confused between the two terms. In this tutorial we will discuss in detail about
Native properties vs Identification properties in UFT.
For people having experience on versions of QTP prior to QTP 10, you should know that Native properties in UFT were called Run-time object properties in QTP and Identification properties in UFT were called Test Object Properties in QTP.
The new Object Spy interface of UFT is compared with the old Object Spy interface in QTP below.
As can be seen in the image above, Native and Identification properties appear as radio buttons in the Object Spy window.
We discussed in the last tutorial, any object is associated with a set of properties and methods. The properties of an object can be used to identify an object uniquely. For an object of given type, the properties are originally defined by the creator (or an organization). For example, in case of WebEdit object in Internet Explorer, its properties were defined by Microsoft™. In the case of JavaEdit object in a Java application, its properties were defined by Sun Microsystems™. These set of original properties for a given object are known as
Native properties in UFT.
The good folks at HPE decided to go a step ahead. They agreed upon a subset of properties from among the native properties that are applicable to UFT AND may be often used for object identification purposes. HPE chose to call such properties as
Identification properties in UFT.
Here you should remember that the name of properties under Native and Identification may or may not map one-to-one. For example, the width property mentioned under Identification properties may not be the same as width property mentioned under Native properties.
At run time, Identification properties can be accessed using .GetROProperty while Native properties can be accessed using .Object notation.
Let us understand this with the help of a demo on sample web based flight reservation application.
We will object spy on the username object in sample application.
We will try to retrieve the name property under Identification properties and namespaceURI property under Native properties.
To retrieve the name property from Identification properties , we will use .GetROProperty
msgbox Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").GetROProperty("name")
To retrieve the namespaceURI property from Native properties , we will use .object notation.
msgbox Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").Object.namespaceURI
The first msgbox will output the value userName while the second msgbox will output the value http://www.w3.org/1999/xhtml
I trust this tutorial has helped you understand the difference between Native vs Identification properties in UFT. Please let us know in the comments section below if you have any questions around this topic.
Additional Reading: GetTOProperty vs GetROProperty
In the next tutorial we will discuss in detail about Object Repository. OR is the heart-and-soul of UFT.
Make sure you enter your name and address below to receive the next tutorial as soon as it is ready.
Here is the complete set of tutorials we have covered till now in the UFT tutorial series:
- Tutorial 1: Introduction to software testing
- Tutorial 2: Introduction to UFT
- Tutorial 3: UFT Add-ins and Add-in Manager
- Tutorial 4: All About UFT Menus
- Tutorial 5: Complete Guide to UFT Panes
- Tutorial 6: Record Your First UFT Script
- Tutorial 7: Classes vs Objects in UFT
- Tutorial 9: Complete Guide to Object Repository in UFT
If you want to keep track of further articles on UFT (QTP). I recommend you to subscribe by Email and have new UFT articles sent directly to your inbox.