The Test Object (TO) property and Runtime Object (RO) property must have confused (or might be still confusing) you at some point of time. Here is our attempt to demystify these for you:

  1. Test objects are the QTP (HP) defined classes that are used to represent the objects in your application under test (AUT). The information about these objects is stored in object repository. Runtime objects are the actual AUT objects in your application which a Test object refers to during the test run. The information about these objects can be accessed using Object Spy.
  2. Test objects classes defined by HP for a particular environment type can be seen in Object Identification dialog present under Tools > Object Identification in QTP/UFT.to-vs-ro-property
  3. Test object properties set is created and maintained by QuickTest (HP). Runtime object properties set is created and maintained by the object creator (Microsoft for IE objects, Mozilla Firefox for Firefox objects, the product developer for ActiveX objects, etc.) Test object properties are normally the subset of runtime object properties.
  4. Test object methods are methods that QuickTest recognizes and records when they are performed on an object while you are recording a test, and that QuickTest performs when your test runs. Runtime object methods are the methods of the object in your application as defined by the object creator(the developer!). You can access and perform runtime object methods using the .Object property.
  5. .GetTOProperty can be used to fetch a particular test object property from the object repository. .GetROProperty can be used to fetch a particular run time object property from the AUT at run time.

Here is a demonstration of GetTOproperty and GetROProperty on DemoAUT site. We will add the username object in object repository. Run the two lines of code below and try to retrieve the value of “value” property.to-vs-ro-property-example

msgbox Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").GetTOProperty("value")

Output is blank since there is no property in the object repository with the name value.

msgbox Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").GetROProperty("value")

Output is mercury since QTP has fetched the value of value property at run time from the AUT.

I hope this makes things clear in regards to Test objects, Run Time objects, GetToProperty and GetRoProperty. In case you have any questions, please feel free to ask in the comments section below.