请问海龙?
我用rational2002录制的脚本和你的一样,只有一处你的:Result = LabelVP (CompareNumeric, "Text=2.", "VP=Alphanumeric;Value=200000")
我的:Result = LabelVP (CompareNumeric, "ObjectIndex=1","VP=Alphanumeric;Value=200000")
第一次按我的回放,“pass”。可建了datapool后,这里我就不知道怎么改了。
同时我按你那个例子,在datapool见建了3列,num1、num2、sum,分别添了数据。可回放出错。下面是我的脚本,麻烦看看。
'$Include "sqautil.sbh"
Sub Main
Dim Result As Integer
dim dp as long
dim x as integer
dim num1 as string
dim num2 as string
dim sum as string
'Initially Recorded: 2005-1-259:06:14
'Script Name: data1
StartApplication "C:\WINNT\system32\calc.exe"
dp=SQADatapoolOpen("jsq")
for x=1 to 5
Call SQADatapoolFetch(dp)
Call SQADatapoolValue(dp,1,num1)
Call SQADatapoolValue(dp,2,num2)
Call SQADatapoolValue(dp,3,sum)
Window SetContext, "Caption=计算器", ""
InputKeys num1 &"{+}"& num2 &"{ENTER}"
Result = LabelVP (CompareNumeric, "ObjectIndex=1", "VP=Alphanumeric;Value="& sum &".")
next
Call SQADatapoolClose(dp)
Window CloseWin, "", ""
End Sub
请问海龙?
我用rational2002录制的脚本和你的一样,只有一处你的:Result = LabelVP (CompareNumeric, "Text=2.", "VP=Alphanumeric;Value=200000")
我的:Result = LabelVP (CompareNumeric, "ObjectIndex=1","VP=Alphanumeric;Value=200000")
第一次按我的回放,“pass”。可建了datapool后,这里我就不知道怎么改了。
同时我按你那个例子,在datapool见建了3列,num1、num2、sum,分别添了数据。可回放出错。下面是我的脚本,麻烦看看。
'$Include "sqautil.sbh"
Sub Main
Dim Result As Integer
dim dp as long
dim x as integer
dim num1 as string
dim num2 as string
dim sum as string
'Initially Recorded: 2005-1-259:06:14
'Script Name: data1
StartApplication "C:\WINNT\system32\calc.exe"
dp=SQADatapoolOpen("jsq")
for x=1 to 5
Call SQADatapoolFetch(dp)
Call SQADatapoolValue(dp,1,num1)
Call SQADatapoolValue(dp,2,num2)
Call SQADatapoolValue(dp,3,sum)
Window SetContext, "Caption=计算器", ""
InputKeys num1 &"{+}"& num2 &"{ENTER}"
Result = LabelVP (CompareNumeric, "ObjectIndex=1", "VP=Alphanumeric;Value="& sum &".")
next
Call SQADatapoolClose(dp)
Window CloseWin, "", ""
End Sub Originally posted by hailong1977 at 2005-1-25 10:00 AM:
我用rational2002录制的脚本和你的一样,只有一处
你的:Result = LabelVP (CompareNumeric, "Text=2.", "VP=Alphanumeric;Value=200000")
我的:Result = LabelVP (CompareNumeric, &quo ...
把你的那行改成 Result = LabelVP (CompareNumeric, "Type=Label;ObjectIndex=1", "VP=Alphanumeric;Value="& sum &".")
试试 在第一次录制脚本中,设置验证点的时候我的不和你的一样,
Result = LabelVP (CompareNumeric, "ObjectIndex=1", "VP=Alphanumeric;Wait=2,30;Value=200000")(我的)
Result = LabelVP( mpareNumeric, "Text=2.", "VP=Alphanumeric;Value=200000")
我在设置验证点的时候不知道选择哪个控件,请指点
我看了上面的程序,在我的机子上也运行了的。
我看了上面的程序,在我的机子上也运行了的。但是在运行数据池的时候,运算结果是对的,但是为什么test log里却不是pass呢? 我运行的同hailong1977一样,也看了阿蓝的帖子,将其改为Result = LabelVP (CompareNumeric, "Type=Label;ObjectIndex=1", "VP=Alphanumeric;Value="& sum &".") ,但是结果还是不行啊 你的datapool里有没有设sum的值啊,不然在验证点比较的时候,由于没有比较的baseline,当然会报错。 Originally posted by fjzpdjn at 2004-10-27 05:10 PM:能帮解答:为什么把 dp设为 long类型
把那段该为试试
Window SetContext, "Caption=计算器", ""
InputKeys "1{+}1{ENTER}"
Result = WindowVP (CompareNumeric, "Caption=计算器", "VP=Alphanumeric;Value=0")
Window SetContext, "Caption=计算器", ""
Window CloseWin, "", "" 上面那个发错了应该是针对这个发表的
Originally posted by gezi68705 at 2004-11-4 01:29 PM:
请教大侠:为什么我录制的脚步是这样的?
Sub Main
Dim Result As Integer
'Initially Recorded: 2004-11-413:21:58
'Script Name: 计算器
StartApplication "C:\WINNT\system32\ ...
你改为这个试试
Window SetContext, "Caption=计算器", ""
InputKeys "1{+}1{ENTER}"
Result = WindowVP (CompareNumeric, "Caption=计算器", "VP=Alphanumeric;Value=0")
Window SetContext, "Caption=计算器", ""
Window CloseWin, "", "" 我把 SCRIPT改了一下,在DATAPOOL中只输入num1 和 num2 的值,然后在script 中算出sum的值,再做比较。如何在Datapool 中赋值,我是用下面几步来实现的:(不好意思我用英文,因为我的是英文版)。
1. Open Rational Task Manager.
2. Select Tools-> Manage-> DataPools.
3. Click on New and enter "jsq" as name. Click OK.
4. You will get a message "An Empty datapool called jsq has been registered..." Select Yes
5. Select Insert Before. In the "Data Type Specification jsq" dialogue, enter "B" in the "Name". Select Insert Before again. Enter "A" in the "Name".
6. Click Save.
7. Click Close.
8. Select OK on the message beginning "If you leave the Datapool editor..."
9. In the "Manage Datapools" dialogue, select jsq and press Edit
10. Click on on Edit Datapool Data in the "Datapool Properties" dialogue.
11. Enter three pairs of numbers. There will be one number in each pair for for A and one for B. and click on Save and Close. For example:
A B
1 0
-1 1
15 16
12. Click on OK in the "Datapool Properties" dialogues.
13. Click on Close in "Manage Datapools."
14. Return to the "Rational Robot" and select File and Playback in the Test "CaclTest-2" Script.
15. Click on OK and if it asks you about overwriting a log, click Yes
16. The system will bring up the Test log. Expand "Script Start" You should observe one "Application Start" and three "Verification Point."
17. If you want to see the numbers each time, go to the Test Add script. Just before "Result - EditBoxVP..." enter the line Print "sum is" & sum
18. Then select File and Playback. (Click after viewing each message.)
下面是我的script.
注意我是在WINDOW XP 下测的,所以StartAppUnderNone "C:\WINDOWS\system32\calc.exe"
'$Include "sqautil.sbh"
Sub Main
Dim Result As Integer
dim dp as long
dim x as integer
dim num1 as string
dim num2 as string
dim sum as string
'Initially Recorded: 7/13/20053:00:36 PM
'Script Name: CaclTest-2
StartAppUnderNone "C:\WINDOWS\system32\calc.exe"
dp=SQADatapoolOpen("jsq")
for x=1 to 3
Call SQADatapoolFetch(dp)
Call SQADatapoolValue(dp,1,num1)
Call SQADatapoolValue(dp,2,num2)
'Call SQADatapoolValue(dp,3,sum)
Window SetContext, "Caption=Calculator", ""
EditBox Click, "ObjectIndex=1", "Coords=301,9"
'InputKeys num1&"{+}"& num2 & "{ENTER}" has mistake?
InputKeys num1 &"{+}"& num2 &"{ENTER}"
sum = str(val(num1) + val(num2))
Print "num1 is" & num1
Print "num2 is" & num2
Print "sum is" & sum
Result = EditBoxVP (CompareNumeric, "ObjectIndex=1", "VP=Alphanumeric;Value="& sum &",")
next
Call SQADatapoolClose(dp)
Window CloseWin, "", ""
End Sub Originally posted by ghost at 2004-8-9 09:32 AM:
取整型,设定不同的Seed就可以了。
必须设置sequence为Random,再将Seed设置成不同的值,就可以生成不同的随机数
我的问题:
1、设置为整型,第1次设置长度为 默认15,后觉得数字太大,将长度设置为2。此时如果不设置最大或最小值,为什么生成的数据都大于2位的?难道最大最小值Robot不会通过设置的字段长度自己控制?
2、如果是数字字母类型的,怎样设置,使得生成的数据长度小于等于length的值,我的与length值等值?
谢谢!!! Originally posted by 小颖_hlj at 2004-7-23 02:50 PM:
你的jsq如何定义的,
定义了几列,为什么对sum也定义一列
定义sum我倒是能理解
可是为什么要从datapool调sum的值呢?
Call SQADatapoolValue(dp,3,sum) ???
??
是把正确结果和sum字段的值比较吗?我在sum里输的值不等于num1+num2,为什么结果都是pass呢[ Last edited by fishbasking on 2005-8-8 at 09:44 ]
是不是因为我的是winxp啊
我的result 不是labelVP而是viewboxVP。终于成了
就是情况和30楼heather的情况一样,还要继续研究啊,呵呵 这是我学robot 的开胃菜,还好有点鼓励啊关于datapool 论坛里有斑竹 海龙 的文章
http://bbs.51testing.com/viewthread.php?tid=42&fpage=1&highlight=datapool datapool的取值没有问题,但是请问如何从文件或是xls文件中取值Why chose Datapool?
记得手册中有句话“如果你的脚本只运行一次,就可以不用Dataool”。是啊,根据楼主的例子,我完全可以用数组来实现加数据的功能啊。请问:这种理解对吗? 论坛上计算器例子的结果是Result = LabelVP (CompareNumeric, "Text=2.", "VP=Alphanumeric;Value=200000")
而我自己录制的是Result = LabelVP (CompareNumeric, "ObjectIndex=1","VP=Alphanumeric;Value=200000")
请高手告诉我,Text=2.和ObjectIndex=1在此处是表示的什么意思,还有二者有什么关系和区别,我的是ObjectIndex=1,要是我把它改成Text=2.回放也能成功。可是我不明白二者表示的具体意思。
[ 本帖最后由 zhanghaiying911 于 2006-7-13 17:52 编辑 ] 怎么没人回答呢!!!!!!!