51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 3268|回复: 12
打印 上一主题 下一主题

[原创] 关于text checkpoint中的“Text to check is displayed before occurrence”的疑问

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2009-4-13 10:44:25 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
比如一文本文档中的内容如下
--mon--11--mo--22--mon--33--mon--44--n--

添加一个text chekpoint,为了验证文本m和n之间的文本是否为o
其中checked text为o
text before 为m,并设置相应的“Text to check is displayed after occurrence”,假设指定为x,默认值为1
text after 为n,并设置相应的“Text to check is displayed before occurrence”,假设指定为y,默认值为1

练习中发现,x的设置起作用,而y的设置不起作用
比如x=1,而y=1,则Text Checkpoint: captured "on--11--mo--22--mon--33--mon--44--" between m and n
比如x=2,而y=1,则Text Checkpoint: captured "o--22--mon--33--mon--44--" between m and n
比如x=3,而y=1,则Text Checkpoint: captured "on--33--mon--44--" between m and n

比如x=5,而y=1,则Text Checkpoint: captured "" between m and n
-----------------------以上的结果与文档上介绍的相符


而y的设置不起作用
比如x=2,而y=1,

比如x=2,而y=2,

比如x=2,而y=3,
比如x=2,而y=4,
则都是相同的结果,Text Checkpoint: captured "o--22--mon--33--mon--44--" between m and n


比如x=2,而y=5,则Text Checkpoint: captured "" between m and n




为什么y的设置不起作用?难道我的理解有错误?


下面是英文帮助文档上的介绍:
Text to check is displayed before occurrence. Checks that the checked text is displayed before the specified text. If the identical text string you specify is displayed more than once on the page, you can specify to which occurrence of the string you are referring.

If you accept the default text that QuickTest recommends, the number in the dialog box will be correct. If you modify the text, confirm that the occurrence number is also accurate.

If you choose a non-unique text string, change the occurrence number appropriately. For example, if you want to check that the words Mercury Tours are displayed before the fourth occurrence of the word the, enter 4 in the Text to check is displayed before occurrence box.


下面是中文帮助文档上的介绍:
要检查的文本显示于出现之前

检查已检查的文本是否在指定文本前显示。

QuickTest 从字符串“在之后显示”的结尾开始计算指定的文本“在之前显示”的出现次数。换句话说,它从选择要检查的文本开始查找指定文本。

如果接受 QuickTest 建议的默认文本,则对话框中的数字将是正确的。如果修改建议的文本字符串,并且指定的字符串显示在突出显示的文本以及“在之前显示”文本中,则需要相应地修改出现次数。

例如,如果要检查句子 my hat is the best 是否显示在单词 hat 之前,请在“要检查的文本显示于出现之前”框中输入 2,以显示希望文本在单词 hat 第二次出现之前显示。



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

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2009-4-14 09:42:42 | 只看该作者
re
回复 支持 反对

使用道具 举报

该用户从未签到

3#
发表于 2009-4-15 17:19:00 | 只看该作者
练习中发现,x的设置起作用,而y的设置不起作用
比如x=1,而y=1,则Text Checkpoint: captured "on--11--mo--22--mon--33--mon--44--" between m and n
比如x=2,而y=1,则Text Checkpoint: captured "o--22--mon--33--mon--44--" between m and n
比如x=3,而y=1,则Text Checkpoint: captured "on--33--mon--44--" between m and n
比如x=5,而y=1,则Text Checkpoint: captured "" between m and n
-----------------------以上的结果与文档上介绍的相符

以上结果你怎么得到的???似乎是不对的
1-1匹配 o
2-1匹配 mo--22--mo
以下原理相同。。。。
回复 支持 反对

使用道具 举报

该用户从未签到

4#
发表于 2009-4-15 17:21:29 | 只看该作者
似乎是你自己搞反了
回复 支持 反对

使用道具 举报

该用户从未签到

5#
 楼主| 发表于 2009-4-16 09:39:58 | 只看该作者
原帖由 wugecat 于 2009-4-15 17:19 发表
练习中发现,x的设置起作用,而y的设置不起作用
以上结果你怎么得到的???似乎是不对的
1-1匹配 o
2-1匹配 mo--22--mo
以下原理相同。。。。

结果是qtp的执行结果,查看结果文件得到的。
好像我没有理解反。
回复 支持 反对

使用道具 举报

该用户从未签到

6#
 楼主| 发表于 2009-4-17 09:20:06 | 只看该作者
就真的没人帮我?
回复 支持 反对

使用道具 举报

该用户从未签到

7#
发表于 2009-4-17 13:36:46 | 只看该作者
我把你的字符串“--mon--11--mo--22--mon--33--mon--44--n--”执行后
X=1,Y=1 结果匹配是“o”
回复 支持 反对

使用道具 举报

该用户从未签到

8#
 楼主| 发表于 2009-4-20 11:42:46 | 只看该作者
原帖由 wugecat 于 2009-4-17 13:36 发表
我把你的字符串“--mon--11--mo--22--mon--33--mon--44--n--”执行后
X=1,Y=1 结果匹配是“o”

为啥我的结果是“on--11--mo--22--mon--33--mon--44--”

本帖子中包含更多资源

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

x
回复 支持 反对

使用道具 举报

该用户从未签到

9#
 楼主| 发表于 2009-4-21 09:30:33 | 只看该作者
呵呵,wugecat哪去了?
回复 支持 反对

使用道具 举报

该用户从未签到

10#
 楼主| 发表于 2009-4-22 09:15:05 | 只看该作者
呵呵,最后一次顶。没人会就算了。
回复 支持 反对

使用道具 举报

该用户从未签到

11#
发表于 2009-4-22 10:05:59 | 只看该作者
我在。。。我一般两天上一次论坛。。不好意思
==我在看看啊
回复 支持 反对

使用道具 举报

该用户从未签到

12#
发表于 2009-4-22 10:21:31 | 只看该作者
我发了短消息给你,请查收
回复 支持 反对

使用道具 举报

该用户从未签到

13#
 楼主| 发表于 2009-4-22 14:17:15 | 只看该作者
按照wugecat的提醒(谢),做了一个简单的html页面进行测试(原来的测试是对记事本中的text进行校验


比如一html页面中的内容如下
--mon--11--mo--22--mon--33--mon--44--n--

添加一个text chekpoint,为了验证文本m和n之间的文本是否为o
其中checked text为o,
text before 为m,并设置相应的“Text to check is displayed after occurrence”,假设指定为x,默认值为1
text after 为n,并设置相应的“Text to check is displayed before occurrence”,假设指定为y,默认值为1

在HTML中运行的结果【见下面蓝色字体部分】
比如x=1,而y=1,则Text Checkpoint: captured "on--11--mo--22--mon--33--mon--44--" between m and n
Text Checkpoint: captured "o" between m and n

比如x=2,而y=1,则Text Checkpoint: captured "o--22--mon--33--mon--44--" between m and n
Text Checkpoint: captured "o--22--mo" between m and n

比如x=3,而y=1,则Text Checkpoint: captured "on--33--mon--44--" between m and n
Text Checkpoint: captured "o" between m and n

比如x=5,而y=1,则Text Checkpoint: captured "" between m and n
Text Checkpoint: captured "" between m and n , expected "o"

在HTML中运行的结果【见下面蓝色字体部分】

比如x=2,而y=1,Text Checkpoint: captured "o--22--mon--33--mon--44--" between m and n
Text Checkpoint: captured "o--22--mo" between m and n

比如x=2,而y=2,Text Checkpoint: captured "o--22--mon--33--mon--44--" between m and n
Text Checkpoint: captured "o--22--mon--33--mo" between m and n

比如x=2,而y=3,Text Checkpoint: captured "o--22--mon--33--mon--44--" between m and n
Text Checkpoint: captured "o--22--mon--33--mon--44--" between m and n

比如x=2,而y=4,则都是相同的结果,Text Checkpoint: captured "o--22--mon--33--mon--44--" between m and n
Text Checkpoint: captured "o--22--mon--33--mon--44--" between m and n

比如x=2,而y=5,则Text Checkpoint: captured "" between m and n
Text Checkpoint: captured "o--22--mon--33--mon--44--" between m and n


在HTML中运行的结果【见下面蓝色字体部分】
其中x=3,而y=2
Text Checkpoint: captured "on--33--mo" between m and n


根据以上对html中的文字进行测试发现:
y:是在找到x(即text before)后,从此处开始查找text after,直到text after的第y次出现。
并且运行结果(上面蓝色部分)都可以按照文档上的说明解释通。

但为什么对记事本中的文字进行校验就会出现不同的结果?

Web ,Standard Windows , VB , ActiveX 不是都可以使用Text Checkpoint吗?
难道记事本不是 Standard Windows 程序?

[ 本帖最后由 haigu 于 2009-4-22 14:20 编辑 ]
回复 支持 反对

使用道具 举报

本版积分规则

关闭

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

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

GMT+8, 2024-10-4 23:24 , Processed in 0.100962 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

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