Monday, October 27, 2008

How to View Object Properties by using Object Spy

This short tutorial guides you to a method by which you can view the Object Properties & Methods with the help of Object Spy in QTP.

We can view the Properties and Methods of any object in an open application with the help of Object Spy pointing hand mechanism. As we move the pointing hand over the objects in the application, ठिर details get displayed in the Object Spy.

These details displayed in the Object Spy are the hierarchy tree of the test object, its properties and values, and the methods associated with the object. For methods, the syntax is also displayed.

Steps to view test object properties or methods:

Step-1: Open the application to the page containing the object on which we want to spy say google.com.

Step-2: Choose Tools > Object Spy or click the Object Spy toolbar button to open the Object Spy dialog box and display the Properties tab.

Or click the Object Spy button from the Object Repository dialog box.

Step-3: Select the details we want to view for the object.

  • Click Run-time Object Properties or Test Object Properties radio button.
  • To view the object’s available methods and syntax, click the Methods tab. Properties tab is displayed by default, enabling us to view the object’s properties and values.
Step-4: In the Object Spy dialog box, click the pointing hand which is displayed on top. QuickTest remains hidden. As we move the pointing hand over the test objects in our application, the test objects get highlighted, and we can view their test object properties or methods in the Object Spy dialog box. We can also view their parent objects in the object hierarchy tree area of the Object Spy dialog box.

Step-5: Highlight or click the object whose properties or methods we want to view। The Object Spy displays the object hierarchy tree and the properties or methods of the object that is selected within the tree.


Step-6: Click the object whose associated methods we want to view. The Object Spy displays the object hierarchy tree and details for the selected object according to our selection.

Step-7: To view the properties or methods of the test object, click the Test Object Properties radio button. To view the properties or methods of the run-time object, click the Run-time Object Properties radio button.

Step-8: If we want to view properties, values, or methods for another object within the displayed tree, highlight or click the object in the tree and select the relevant options, as described in step 3 above.

Step-9: If we want to copy an object property or value, or a method’s syntax to the Clipboard, click the property, value, or method to highlight it. The value gets displayed in the selected property / value or method syntax box which is located above the Description box. Highlight the text in the box and use CTRL + C to copy the text to the Clipboard or right-click the highlighted text and choose Copy from the menu.

Keywords: QTP, Quicktest Professional, QTP Object Spy, QTP Tutorials