What is the difference between RO-Properties and TO-Properties in QTP?

老子叫甜甜 提交于 2019-12-10 12:10:37

问题


In QTP each test object supports the following methods

GetRoProperty
GetToProperty
SetToProperty
GetToProperties

What is the difference between a RO-property and a TO-property and why can I only set a TO-property and not an RO-property?


回答1:


The difference between RO-Properties and TO-Properties are that TO properties refer to the properties as they exist in the Test Object saved in the test (i.e. in the object repository or as described in descriptive programming) and the RO-Properties refer to the RunTime object (i.e. the object as it appears in the Application Under Test (AUT)).

From this distinction a few things arise

  1. Accessing a TO property doesn't require the AUT to be open
  2. Accessing an RO property requires the AUT to be open and the object to be uniquely described
  3. You can set the value of a TO property but not that of an RO property

In addition to the QTP specific properties some technologies also support accessing the native object's properties via the .Object property of the test object.




回答2:


please find the below difference between GetRoProperty , GetToProperty, GetTOProperties :

GetTOProperty : (Get Test Object Property) : GetTOProperty can be used to fetch a particular test object property from object repository.

GetTOProperties : GetTOProperties is used to enumerate all the properties of an object used for identification.

GetROProperty : (Get Runtime Object Property)

GetROProperty is used to fetch the property value of an object at runtime.

Let's take an example :

Suppose there is link present on some webpage and we have to verify the text of the link at runtime,

sLinkText = Browser("title:=Google").Page("title:=Google").Link("html tag:=a","visible:=true").GetROProperty("innertext")
msgbox sLinkText

output:

Gmail

Similarly, we can fetch any property of any particular object at run time.



来源:https://stackoverflow.com/questions/8699160/what-is-the-difference-between-ro-properties-and-to-properties-in-qtp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!