Object Spy, GetRoProperty, GetToProperty in QTP/UFT with Example
This tutorial demonstrates OBJECT SPY.
Object Spy can help determine the useful properties and methods associated with an object in your environment.
The HP/Micro Focus UFT tutorials also describes GetROProperty, GetTOProperty & SetTOProperty
Click here if the video is not accessible
GetRoProperty
- GetRoProperty – is an inbuilt method used to retrieve the runtime value of an object property.
- There are 4 steps involved in using the GetRoProperty
- Step 1) Record the Object on which you want to use the GetRoProperty in Object Repository
- Step 2) For the recorded object identifies the run-time property which could be used. You may use Object Spy.
- Step 3) Use GetRoProperty method to retrieve the identified Run-time property and store the value in a variable
- Step 4) Use this value for further deductions
SetToProperty & GetToProperty
- Consider a Web Button stored in the Object Repository
- When the test is run QTP creates a copy of this object called Test Object and compares it with the Run Time Object
- Using GetToProperty you can retrieve the value of a property of Test Object
- Using SetToProperty you can change the property value of a Test Object
- When the test is completed, this test object is discarded and so are any modifications you made in the object properties using the SetToProperty
- When the test is re-run, a new copy of the test object is created with original property values stored in the object repository
- You can consider using GetToProperty and SetToProperty when your test script has multiple lines of codes and your environment is sporadic
- For a note, there is no SetRoProperty
Object Spy:
- Object spy is a feature in QTP using which you can view both the test and run-time object properties and methods.
- It also gives the syntax for a selected method.
- Object Spy gives the complete hierarchy of the object you have selected