GetRoProperty , SetToProperty & GetToProperty in UFT

While developing automation test scripts GetRoProperty method is widely used in UFT to perform various kinds of verifications. In this article, we will see uses of the three inbuilt methods GetRoProperty, SetToProperty, and GetToProperty in UFT.

GetRoProperty in UFT

This is a built-in method in UFT that is used to retrieve the run-time value of an object property from the object in the application.
Syntax
object.GetROProperty (Property Name)
Example: You are supposed to check the default selected value of a WebList object. For this example, I will use the Mercury Tour Demo Application.
weblist
Using Object Spy you can look for the required object property that you want to retrieve at run-time from the application.
getRoProperty in UFT
We can use the “selection” property as it showing the current value of the WebList object. Write the following code to retrieve the value of the selected item from the fromPort WebList box.

Output

In the message box, the output would be “Acapulco

etRoProperty-UFT-02

SetToProperty in UFT

SetToProperty can be used to set the value of the specified description properties in the test object description that is there in the Object Repository.
Syntax
object.SetTOProperty (Property, Value)
Example: We will Set the HTML ID for fromPort WebList object.

GetToProperty in UFT

GetToProperty is used to retrieve the value of the specified description properties from the test object description.
Syntax
object.GetTOProperty(Property)

Difference Between GetRoProperty & GetToProperty

GetRoProperty retrieves the run-time value of an object property from the object in the application. However, GetToProperty retrieves the value of the specified description properties from the test object description that means it retrieves the object property that is stored in the object repository. It can’t return the runtime property of a Test Object from the application.
Let’s understand this with an example. If we spy the object property of fromPort WebList box, its HTML ID property value will be shown as empty.
getRoProperty-UFT3
We will set an “html id” value for it and try to retrieve its value using both GetRoProperty and GetToProperty.

If we execute the above code the output will be different for both. The GetRoProperty will return an empty value. However, the GetToProperty will return to value 123.

output

Recommended Posts

Leave a Reply