|
计算器例子(我的是乘法),详细过程如下:
1.我在testmanager 设置datapool为dp1,字段num1,num2,sum 均为整型,seed为不同的随机数,且数据已经生成。
2.我先录制完脚本,脚本如下:
Sub Main
Dim Result As Integer
'Initially Recorded: 2005-12-7 11:02:50
'Script Name: 4
StartApplication """F:\tested\vb test\Project1.exe"""
Window SetContext, "Name=Form1", ""
EditBox Left_Drag, "Name=Text1", "Coords=32,9,-14,13"
InputKeys "5"
EditBox Left_Drag, "Name=Text2", "Coords=31,14,-25,12"
InputKeys "4"
PushButton Click, "Name=Command1"
Result = EditBoxVP (CompareNumeric, "Name=Text3", "VP=Alphanumeric;Value=2000000")
PushButton Click, "Name=Command2"
End Sub
然后我将“Value=2000000”改为“20”,进行回放,PASS。
3.我再次修改脚本,脚本如下(或见附件):
Sub Main
Dim Result As Integer
dim x as integer
dim num1 as string
dim num2 as string
dim sum as string
dim dp as long
'Initially Recorded: 2005-12-7 10:21:17
'Script Name: 3
StartApplication """F:\tested\vb test\Project1.exe"""
dp=SQADatapoolOpen("dp1")
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, "Name=Form1", ""
EditBox Left_Drag, "Name=Text1", "Coords=25,15,-30,9"
InputKeys num1
EditBox Left_Drag, "Name=Text2", "Coords=21,7,-44,9"
InputKeys num2
PushButton Click, "Name=Command1" '计算功能(乘法运算)
Result = EditBoxVP (CompareNumeric, "Name=Text3", "VP=Alphanumeric;Value="& sum &".")
next
Call SQADatapoolClose(dp)
PushButton Click, "Name=Command2" '退出功能
End Sub
然后回放,报告出错,错误信息如下:
Compiling 3.rec...
3.rec(13) Error: Variable SQADatapoolOpen undefined
3.rec(15) Error: Unknown function: SQADatapoolFetch
3.rec(16) Error: Unknown function: SQADatapoolValue
3.rec(17) Error: Unknown function: SQADatapoolValue
3.rec(18) Error: Unknown function: SQADatapoolValue
3.rec(29) Error: Unknown function: SQADatapoolClose
0 warning(s), 6 error(s)
我的问题:
1.我的脚本里怎么没有头文件:' $Include "sqautil.sbh"?我在网上看见很多网友的脚本里都有这个头文件。
2.我的datapool都设置好了,为什么还是报出没有定义SQADatapoolOpen ?
请高手指教!我的邮箱:qing_dragon@sina.com。谢谢! |
|