首页 新闻 论坛 群组 Blog 文档 下载 读书 Tag 网摘 搜索 .NET Java 游戏 视频 人才 外包 第二书店 程序员
您的位置:软件测试频道-正文

QTP的Run-time Object与Test Object 属性之间的区别2008-05-26 来自:lizhe1985  [收藏到我的网摘]

来源:实用性测试(Pragmatistic Testing) - CSDNBlog

用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")

推荐人评论

用object spy查看测试对象时,有runtime object properties 和 test object properties两种,那么它们有什么区别呢?

用户评论

正在载入评论列表...

是谁推荐了此篇文章

专家头像李哲
个人blog发送信息
李哲推荐的其他文章

热点新闻

热点评论

    精彩专题

    资源下载

    网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|版权声明|问题报告

    北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
    世纪乐知(北京)网络技术有限公司 提供技术支持
    Copyright 2000-2008, CSDN.NET, All Rights Reserved
    GongshangLogo