|
我在使用robot录制脚本一次时,每次 回放只能使用一组数据,我想产生多组
随机数据,然后连续播放,我将 rational robot和 Ratioal TestManage共同使用,首先用 datapools 产生了20组数据(默认的),我录制的是一个用户注册的过程,字段名有:*用户ID,*密码,*确认密码,*管理员类型,*公司名,*名称 *电子邮箱,电话,手机,传真,然后我在脚本中该如何引用这些数据呢,
我的数据池名称是mypool,以下是我参考帮助加以修改写的代码,但是我回放不出来哦,不知道是不是 哪里出了问题,望指点一二,谢谢!
'include"sqautil.sbh"
Sub Main
Dim Result As Integer
Dim x As integer
' open a datapool name mypool
dp=SQADatapoolOpen("mypool")
'perform the transaction 20 times,using a new set of data from the datapool each time
for x=1 to 20
'fetch a row from the datapool
call SQADatapoolFetch(dp)
'begin the transaction
'credit card Number
Window SetContext, "Caption=后台管理 - Microsoft Internet Explorer", ""
Browser SetFrame,"Type=HTMLFrame;HTMLId=leftFrame",""
Browser NewPage,"",""
HTMLLink Click, "Type=HTMLLink;HTMLText=Admin Management", ""
HTMLLink Click, "Type=HTMLLink;HTMLText=管理员列表", ""
Browser SetFrame,"Type=HTMLFrame;HTMLId=mainframe",""
Browser NewPage,"",""
EditBox Click, "Type=EditBox;Name=login", "Coords=28,16"
'assign 用户名 a value from datapool column #1
call SQADatapoolvalue(dp,1,*用户ID)
InputKeys "*用户ID"
EditBox Click, "Type=EditBox;Name=login", "Coords=35,17"
EditBox Click, "Type=EditBox;Name=password", "Coords=35,17"
call SQADatapoolvalue(dp,2,*密码)
InputKeys "*密码"
EditBox Click, "Type=EditBox;Name=password1", "Coords=31,10"
call SQADatapoolvalue(dp,3,*确认密码)
InputKeys "*确认密码"
ComboBox Click, "Type=ComboBox;Name=usertype", ""
ComboListBox Click, "Type=ComboListBox;Name=usertype", "Text=Site Admin"
EditBox Click, "Type=EditBox;Name=companyname", "Coords=17,14"
call SQADatapoolvalue(dp,4,*公司名)
InputKeys "*公司名"
EditBox Click, "Type=EditBox;Name=name", "Coords=26,13"
call SQADatapoolvalue(dp,5,*名称)
InputKeys "*名称"
EditBox Click, "Type=EditBox;Name=email", "Coords=25,7"
call SQADatapoolvalue(dp,6,*电子邮箱)
InputKeys "*电子邮箱"
EditBox Click, "Type=EditBox;Name=phone", "Coords=32,9"
call SQADatapoolvalue(dp,7,电话)
InputKeys "电话"
EditBox Click, "Type=EditBox;Name=mobile", "Coords=21,4"
call SQADatapoolvalue(dp,8,手机)
InputKeys "手机"
EditBox Click, "Type=EditBox;Name=fax", "Coords=44,14"
call SQADatapoolvalue(dp,9,传真)
InputKeys "传真"
PushButton Click, "Type=PushButton;Name=Submit6"
Browser NewPage,"",""
PushButton Click, "Type=PushButton;Name=Submit63"
next x
End Sub |
|