Identify objects during a run session
Relevant for: GUI tests and components
UFT One uses a human-like technique for identifying objects during the run session.
How UFT One finds an object in run-time
Suppose as a continuation to the experiment described in How UFT One learns objects, Alex is now asked to identify the same "item" he initially identified but in a new, yet similar environment.
The first photograph he is shown is the original photograph. He searches for the same Caucasian girl, about eight years old, with long, brown hair that he was asked to remember and immediately picks her out. In the second photograph, the children are playing on the playground equipment, but Alex is still able to easily identify the girl using the same criteria.
Similarly, during a run session, UFT One searches for a run-time object that exactly matches the description of the test object it learned previously. It expects to find a perfect match for both the mandatory and any assistive properties it used to create a unique description while learning the object. As long as the object in the application does not change significantly, the description learned is almost always sufficient for UFT One to uniquely identify the object. This is true for most objects, but your application could include objects that are more difficult to identify during subsequent run sessions.
For example, Alex is told he will have to recognize a particular tree out of multiple trees in the photo, and he knows he is going to have to be able to identify it again in a photo taken from a different angle. If there isn't enough clearly identifying information about the tree itself, then he might take note of where the tree is located relative to some other permanent item, such as a nearby lamp post or picnic table. Then he will be able to identify the tree again, even if the next picture he sees is from a different angle (as long as all the required items are still visible in the picture).
This is similar to the visual relation identifier property, which enables UFT One to identify test objects according to their neighboring objects in the application. You use this property to link less stable test objects to more unique test objects, and as long as those objects in the application maintain their relative location to your object, UFT One should still be able to identify the test object even after predictable user interface changes in the application.
Consider the final phase of Alex's experiment. In this phase, the tester shows Alex another photograph of the same family at the same location, but the children are older and there are also more children playing on the playground. Alex first searches for a girl with the same characteristics he used to identify the girl in the other pictures (the test object), but none of the Caucasian girls in the picture have long, brown hair. Luckily, Alex was smart enough to remember some additional information about the girl's appearance when he first saw the picture the previous week. He is able to pick her out (the run-time object), even though her hair is now short and dyed blond.
How is he able to do this? First, he considers which features he knows he must find. Alex knows that he is still looking for a Caucasian female, and if he were not able to find anyone that matched this description, he would assume she is not in the photograph.
After he has limited the possibilities to the four Caucasian females in this new photograph, he thinks about the other characteristics he has been using to identify the girl—her age, hair color, and hair length. He knows that some time has passed and some of the other characteristics he remembers may have changed, even though she is still the same person.
Thus, since none of the Caucasian girls have long, dark hair, he ignores these characteristics and searches for someone with the eyes and nose he remembers. He finds two girls with similar eyes, but only one of these has the petite nose he remembers from the original picture. Even though these are less prominent features, he is able to use them to identify the girl.
UFT One uses a very similar process of elimination with its Smart Identification mechanism to identify an object, even when the learned description is no longer accurate. Even if the values of your description properties change, UFT One maintains the reusability of your test or component by identifying the object using Smart Identification. For details on Smart Identification, see Configure object identification.
The remainder of this
Description properties vs. runtime properties
UFT One uses unique terms to differentiate between the properties and operations for test objects and run-time objects.
Test Objects |
Run-time Objects |
---|---|
Description properties are UFT One-specific properties that UFT One uses to identify objects in applications, to retrieve and store information about those objects, or to compare stored values with the current values of an object in an application. The description properties available for a test object are determined by its test object class (and not by the actual properties available for the object in the application). |
Native properties are the properties created by the object creator for each run-time object. (Examples of object creators include Microsoft for Microsoft Internet Explorer objects and the product developer for ActiveX objects.) |
A test object operation is a method or property that UFT One can perform on an object from a particular test object class. Example: UFT One can perform the Click method on a WebButton test object. |
Native operations are the methods of the object in your application as defined by the object creator. |
Define run-time properties
View and modify properties and operations for test objects and run-time objects in a number of ways:
-
View the syntax of the native operations of any visible object using the Operations tab of the Object Spy. For details, see Use the Object Spy.
-
Retrieve native property values from the run-time object during the run session by adding GetROProperty statements. For details, see Retrieve and set values.
-
If the available test object operations and description properties do not provide the functionality you need, access the internal operations and native properties of the run-time object using the Object property or the attribute object property for Web objects. For details, see Native properties and operations and the Object property in the Common Methods and Properties section of the UFT One Object Model Reference for GUI Testing.
Note: When using Insight or Text test objects, which UFT One recognizes in the application based on the object's appearance, UFT One does not use the object's programming interface and therefore native operations and properties are not relevant.