Friday, November 6, 2015

Virtual Objects

11/6/2015:
Source: http://automated-360.com/qtp/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.

Source: Training
Ex:
- Creating virtual object for WinButton

1. Go to Tools menu->Virtual Objects ->New Virtual Object = Virtual object wizard gets displayed


2. Click on Mark Object and then take the icon to the object(here Login button) that you wanted to virtualize.

3. Click Next. -> Object configuration will be open. Ensure Parent Only radio button is selected.




4. click Next. Enter the virtual button name. Click on Finish. Thats it Virtual object is created for Winbutton.


5. When you record the script, you would see the below script when user click on Login button.


So it means we could access the Login button using the name of the virtual object that we have created for it using wizard before running the script.(not used object repository or spy here)


Source: http://automated-360.com/qtp/virtual-objects-when-nothing-works/

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.

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.
Tips
  • 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.


No comments:

Post a Comment