您的位置:首页 > 编程语言 > Qt开发

QTP的Run-time Object与Test Object 属性之间的区别

2008-05-24 17:34 423 查看
QTP的Run-time Object与Test Object 属性之间的区别
用object spy查看测试对象时,有runtime object properties 和 test object properties两种,那么它们有什么区别呢?
从QTP的帮助文档可以看出Run-time Object Properties与Test Object Properties之间的区别:
(1)Run-time Object Properties / Run-time Object Methods 
Displays the run-time (native) object properties or methods associated with the object selected in the Object Spy's object hierarchy tree. Note that the label changes depending on whether the Properties or Methods tab is selected. You can use the Object property to retrieve or activate run-time properties and methods displayed in the Object Spy. For more information, see Retrieving Run-Time Object Properties and Activating Run-Time Object Methods. 
(2)Test Object Properties / Test Object Methods 
Displays the test object properties or methods associated with the object selected in the Object Spy's object hierarchy tree. Note that the label changes depending on whether the Properties or Methods tab is selected. You can use the GetTOProperty and SetTOProperty methods to retrieve and set the value of test object properties for test objects in your test. You can use the GetROProperty to retrieve the current property value of objects in your application during the run session. For more information, see Retrieving and Setting Test Object Property Values. 
Run-time Object展现的是运行时本地测试对象的属性或方法。在脚本中可以通过Object属性来访问和获取Run-time Object的属性或执行其方法。例如:
Dim MyDay Set MyDay=Browser("index").Page("Untitled").ActiveX("MSCAL.Calendar.7").Object.Day
下面的脚本则通过Object属性执行测试对象的某个方法:
Dim MyWebEdit Set MyWebEdit=Browser("Mercury Tours").Page("Mercury Tours").WebEdit("username").Object MyWebEdit.focus
 
而对于Test Object则可通过GetTOProperty 和 SetTOProperty 来获取或设置测试对象的属性值。例如:
Browser("QA Home Page").Page("QA Home Page").WebButton("Submit").SetTOProperty "Name", "my button"
ButtonName=Browser("QA Home Page").Page("QA Home Page").WebButton("Submit").GetTOProperty("Name")
下面的脚本通过GetROProperty访问测试对象当前的属性值:
link_href = Browser("Mercury Technologies").Page("Mercury Technologies").Link("Jobs").GetROProperty("href")
 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息