Software Testing Learning Hub

Virtual Objects in QTP


The objects that QTP cannot recognize in a application are called non-standard objects or virtual objects. mostly QTP doesn’t identify the objects because of improper add-ins or if the objects are advanced controls.On a application page, these virtual objects may behave like a standard objects. In this scenario we can map these virtual objects to standard objects by using Virtual Object Wizard.

Steps to create a virtual object

1. Defining a virtual object using the Virtual Object Wizard
Tools -> Virtual Objects -> New Virtual Object

2. The Wizard gets open which prompts you to map the virtual object with standard object class.

3. Select the area of the virtual object using a cross hairs pointer.

4. Select a test object as the parent of the virtual object.

5. Define a name and a collection for the virtual object.

Guidelines for using Virtual objects-

1. QTP does not support virtual objects for analog or low-level recording.

2. During a run session, please 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 and result into failed object identification

3. Use virtual objects only when recording and running a test. It not possible to insert any type of checkpoint on a virtual object, or use the Object Spy to view its properties.

4. 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.