Tuesday 18 June 2013

Handling Virtual Objects In QTP

Virtual Object

Virtual Objects comes into picture if QTP is unable to recognize an object and we often see errors as Object not found. This is because even though you have recorded the actions during playback time QTP is unable to recognize an object and because of which the script fails.


Virtual object enable you to create and run tests on objects that are not normally recognized by QuickTest. Your application may contain objects that behave like standard objects but are not recognized by QuickTest. You can define these objects as virtual objects and map them to standard classes, such as a button or a check box. QuickTest emulates the user's action on the virtual object during the run session. In the test results, the virtual object is displayed as though it is a standard class object.


You define a virtual object using the Virtual Object Wizard (Tools > Virtual Objects > New Virtual Object). 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 cross-hairs 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.


Virtual Objects in QTP are created to resolve the object recognition problems in QTP. When an area of an application is not recognized by QTP we use the Virtual Object Wizard to map the area to a standard Class. These virtual objects are generally used to resolve the object recognition problems. All the Virtual Objects created are stored in the Virtual Object Manager. After we have learned an object as a Virtual Object we can record on that object successfully. You can create a Virtual Object by navigating to Tools, Virtual Objects, and New Virtual Object.

What is Virtual Object Collection?
 A virtual object collection is a group of virtual objects that is stored in the Virtual Object Manager under a descriptive name.


How to disable virtual Objects while recording?

In order to disable the Virtual Objects Navigate

Go to Tools-->Options--> General Tab--> Disable Recognition of virtual objects while recording

Check and uncheck this option to disable or enable virtual objects while recording.


Storage location of Virtual Objects

 If you create any virtual objects automatically those objects will be stored in

“QuickTest installation folder\ dat \ VoTemplate”


Extension of virtual objects file

 .VOT


How to use virtual objects on different machines?

After creation of virtual objects copy QuickTest installation folder\ dat \ VoTemplate Folder to other machines on which you want to use virtual objects.


Limitations and drawbacks of Virtual Objects

      1. QuickTest does not support virtual objects for analog or low-level recording.
      2. Not possible to apply a checkpoint on a virtual object
      3. Not possible to add virtual objects using Object Repository
4. Virtual Objects doesn’t support all objects and methods. 
 5. We cannot use object spy on a Virtual Object.
6. We can only record on Virtual Objects.
7. Scroll Bars and Labels cannot be treated as Virtual Objects.
8. May not run perfectly on different screen resolutions if a test using Virtual Objects.
9. Virtual object uses the properties Name, Height, Width, X, Y which the properties are having maximum possibilities for frequent change.
10. During a run session, make sure that the application window is the same size and in the same location as it was during recording, otherwise the coordinates of the virtual object relative to its parent object may be different, and this may affect the success of the run session.
  11. You can use virtual objects only when recording and running a test. You cannot insert any type of checkpoint on a virtual object, or use the Object Spy to view its properties.
        12. To perform an operation in the Active Screen on a marked virtual object, you must first record it, so that its properties are saved in the test object description in the object repository. If you perform an operation in the Active Screen on a virtual object that has not yet been recorded, QuickTest treats it as a standard object.

When Object recognition Problem occurs in QTP during playback on the Application Under test there are ways to handle this Object Recognition Problem. It depends solely on the user as to what they want to use.

The different ways to handle Object Recognition Problem are:

1. By Creating Virtual Objects.
2. Using Low Level Recording.
3. Using Analog Recording.

No comments:

Post a Comment