51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2105|回复: 2
打印 上一主题 下一主题

[求助] Descriptive programming

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2008-1-3 11:35:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
原脚本:window("Notepad").WinMenu("Menu").Select "File; print.... Ctrl+P"
为了使这句脚本只执行制定的Txt文件而不是所有的,改动如下:
window("text:=test.txt - Notepad").WinMenu("Menu").Select "File; print.... Ctrl+P"
意思是只对文件名为test.txt的文件执行,但运行一下却提示找不到对象:Menu,
file:///C:/DOCUME%7E1/WUZHIY%7E2/LOCALS%7E1/Temp/moz-screenshot.jpgfile:///C:/DOCUME%7E1/WUZHIY%7E2/LOCALS%7E1/Temp/moz-screenshot-1.jpg
察看了一下对象库中确实有Menu对象。

高手请指点!

[ 本帖最后由 wuzhiyongnihao 于 2008-1-3 11:57 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2008-1-3 12:11:25 | 只看该作者
When using programmatic descriptions from a specific point within a
test object hierarchy, you must continue to use programmatic descriptions
from that point onward within the same statement. If you specify a test
object by its object repository name after other objects in the hierarchy have
been specified using programmatic descriptions, QuickTest cannot identify
the object.
For example, you can use the following statement since it uses
programmatic descriptions throughout the entire test object hierarchy:
Browser("Title:=Mercury Tours").Page("Title:=Mercury Tours").
WebEdit("Name:=Author", "Index:=3").Set "Mark Twain"
You can also use the statement below, since it uses programmatic
descriptions from a certain point in the description (starting from the Page
object description):
Browser("Mercury Tours").Page("Title:=Mercury Tours").
WebEdit("Name:=Author", "Index:=3").Set "Mark Twain"
However, you cannot use the following statement, since it uses
programmatic descriptions for the Browser and Page objects but then
attempts to use an object repository name for the WebEdit test object:
Browser("Title:=Mercury Tours").Page("Title:=Mercury Tours").
WebEdit("Author").Set "Mark Twain"
QuickTest tries to locate the WebEdit object based on its name, but cannot
locate it in the repository because the parent objects were specified using
programmatic descriptions.
如果你前面的对象用描述性编程,后面的也一定要用描述性的,不然会出错的.
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2008-1-3 12:24:43 | 只看该作者
多谢楼上关注。

真实的只需求是要用描述性编程识别最外端的窗口,只要它唯一确定后,里面的各层对话框原本不必须用描述性编程的。

象您说的规则,岂不是下面所有的对象都要用描述性编程?那我就要手动更改所有原本不用更改的脚本。有点费时哦,甚至比写一般程序还费时(因为我要针对每个对象去设置一个不同于name的属性,然后引用这个属性)。这样的话,描述性编程岂不是效率很低?各位是怎么用描述性编程的?用过的请指教
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-9-22 03:55 , Processed in 0.085186 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表