Virtual Objects – When Nothing works
When Nothing Works Virtual Objects is the weapon to achieve your goal. Many of the times you will find that QTP is not able to recognize an object, even if the object behaves like a standard object. Virtual objects helps in such situation, to be able to identify and run tests.
Virtual object feature in QTP enables us to create and run tests on objects that are not normally recognized by QTP. we can define such objects as virtual objects and map them to standard classes like button, checkbox etc.QuickTest emulates the actions on virtual object during the run session. A virtual object can be defined using the virtual Object Wizard. The wizard prompts you to select the standard object class to which you want to map the virtual object. You then mark the boundaries of the virtual object using a crosshairs pointer. Next, you select a test object as the parent of the virtual object. Finally, you specify a name and a collection for the virtual object. A virtual object collection is a group of virtual objects that is stored in the Virtual Object Manager under a descriptive name. Virrtual Object Manager feature enables us to create and manage virtual objects.
Virtual Object Wizard
Launch Virtual Object Wizard by selecting Tools > Virtual Objects > New Virtual Object
Select Next at Welcome screen
|figure 1 : Virtual Object Wizard Welcome screen|
Select the class which most resembles your virtual object.
|figure 2 : Map to a Standard Class|
Click on Mark object button and mark the area in application (around the object you want to create virtual)
|figure 3 : Mark Virtual Object|
Select one of the following options
- Entire Parent hierarchy – if you want to add the whole hierarchy.
- Parent only – if you want to add only the parent.
|figure 4 : Object Configuration|
Specify the desired object name and the collection name.
|figure 5 : Save Virtual Object|
Virtual Object Manager
Select Tools > Virtual Objects > Virtual Object Manager to open Virtual Object Manager.Virtual object manager list all of available virtual object collections. We can delete the virtual object from virtual object collections.
|figure 6 : Virtual Object Manager|
To disable recognition of virtual objects while recording select Tools > Options and click General tab, and select the Disable recognition of virtual objects while recording check box.
- Object Spy cannot be used on virtual objects
- Scroll bars and Labels cannot be treated as Virtual objects
- QTP does not support virtual objects for analog or low level recording.