GetROProperty, GetTOProperty, GetTOProperties, SetTOProperty

Prerequisite Knowledge

In order to understand the Get/Set – RO/TO – Property/Properties, there’s some preliminary information you need to know:
UFT/QTP Basics | Using Object Spy with Object Identification


What is GetROProperty?

GetROProperty is used to fetch a Runtime Object property from the AUT or the application you are currently testing.

So GetROProperty = Get RO (Runtime Object) Property

Example:

Step 1: Tell QTP to open Internet Explorer. Record and Run clicking the “Search Button” on Google.com. You will get this code:

Step 2: In front of the 2nd line of code, add MsgBox. At the end of the 2nd line of code, add GetROProperty(“Value”).

Output:

1

So the value retrieved is “Google Search”, as shown by the Message Box. Note that you are telling QTP to retrieve the Runtime Property Value of the web button “Google Search”. That’s why the value comes up as “Google Search”.

What is GetTOProperty?

GetTOProperty is used to fetch a Test Object property from the Object Repository.

So GetTOProperty = Get TO (Test Object) Property

Example:

Output:

Same as GetROProperty output. However, the QTP Software is extracting this value from the Test Object stored in the Object Repository, and not directly from the AUT or running application.

What is GetTOProperties?

Same as GetTOProperty, but for multiple Object Properties. If you have a better explanation, kindly leave it in the comments below

What is SetTOProperty?

SetTOProperty changes the value of a test object property. SetTOProperty does not change the OR (Object Repository), but SetTOProperty only temporarily changes how QTP identifies an Object for the duration of the Testing Runtime.

What's Your Opinion?