QTP also uses a "human" like technology for object identification. During Record Time QTP tries to learn properties of a GUI object on which operation is performed. During Run-Time QTP compares the stored object properties with actual properties of object available on screen and uniquely identifies an object independent of its location on screen
The stored object and together with its properties is called TEST Object
During Run-Time, the actual object available on the application under test is called Run-Time Object
This is HP UFT's "Test Object Model"
Information about the Test Objects is stored in Object Repository
Add-ins help in instructing Quick Test in advance of the nature of object to be recorded so it as to reduce the time required to learn its properties
Following video tutorial demonstrates how QTP identifies a GUI Object (on-screen)
QTP stores Object and its properties in Object Repository to identify them during run-time. An Object could have large number of properties associated with it. For example in Web Environment a Button could have the following properties associated.
If QTP will try and remember all the available properties for an object, size of Object Repository will bloat and script execution time will increase drastically. To avoid this, QTP by default , does not store all the properties of an object but a limited no of typical properties for an object which helps in its unique identification. This choice of properties(to be saved during record time) for various environments and objects is stored in Object Identification
An object property and its value is called Object Description . The Object Description is used to uniquely identify the corresponding Object. For example , for a WebButton property "name" and its value "Login" together can be termed as Object Description for that Web Button.
To acces, In QTP in Tools Menu , select Object Identification. In Object Identification Dialog Box you can see a drop down of all the environments installed and loaded.
You can select an environment and QTP auto populates list of all the supported objects belonging to that environment. On the right QTP lists the properties that will be stored for the object. The list is divided into
- Mandatory properties will be stored by default for that object
- Assistive propertiesIn case during record time of script QTP can NOT create a unique description of the object it will store the assistive properties
To understand this better consider the example of an Web Image.
- QTP will store value of alt ,html tag, image type, properties mandatory even if it can uniquely identity it using the alt property alone.
- In case it can not create unique description using mandatory property ,QTP will store assistive property. In this case QTP will store the class property .
- If this property helps create a unique description of the object, QTP will not store file name, height property. If class property is not sufficient to create unique description, QTP will store file name property . If file name property creates a unique description QTP will not store height property and so on.
- Suppose during Record Time, QTP has only stored class property. At Run - time ,QTP will forget the distinction between mandatory and assistive properties and compare all the recorded properties.
- Even if any one of the properties does not match its stored value , Script fails