Hope you already know what the concept of “Objects” in UFT Automation is. If not, please refer my earlier post “Objects – The fundamental building blocks for Automation!”!
As stated in previous post – Textbox, Button, Image, Checkbox, Dropdown, Hyperlink, etc. – everything which is visible in an application is known as “Object”. Automation is all about identifying these “Objects” in the application and the subsequent “Actions” to-be-performed on it. But the question is – How do you identify different ‘Objects’ in the application via HP UFT?
For Object identification, UFT needs a way to create a unique ‘object description’ for each object in an application. And UFT uses ‘Object properties’ to create that Object’s description. Let’s take an analogy – Say you want to post a letter to your friend’s house (Object). Can you do that without an address (Object Description)? You will need complete address like House No, Street, Locality, City, State, Country & a Pin code (Object Properties). Hope you got it 😉 A set of Property values >> Object Description >> Object.
Mandatory properties: represents the core object properties.
E.g. Name & Text properties for a Link Object.
Assistive properties: But say more than one object have the same values for Mandatory properties, i.e. mandatory properties are not enough to uniquely identify the object >> Assistive properties are additional properties which will then be used to uniquely identify the object.
E.g. Two links have the same Name & Text but different URLs >> In that case URL is the assistive property.
Ordinal identifiers: indexes of the objects with respect to mandatory and assistive properties.
E.g. Index, Location, Creation Time, etc.
- Fetch all the mandatory properties of the object and check if the unique object description can be created. If not then, continue to step 2.
- Add one assistive property at a time to the object repository and try to create a unique object description.
- If unique description cannot be created then, UFT will use the ‘ordinal identifiers’.
The Basic UFT approach
- At Record time, store some Object properties so that it can be identified uniquely (Test Object: Stored Object & its properties)
- At Run time, identify the object using above stored Object properties (values) – independent of its location on screen (Run-time Object: Run-Time actual object available on the application under test)
- Perform required action on that object
This is HP UFT’s “Test Object Model”. If Object cannot be uniquely identified using above approach, then there are other methods for Object Identification – like Smart Identification. Will talk about those in future posts. Hope this post helped to get a basic understanding of how UFT identifies the Objects!