用Datapool莫名其妙的问题
用Datapool实现验证多个用户登陆是否成功。8个用户。。。第5个就没从Datapool里读username了。。。。一头雾水。。。
脚本如下
'$Include: "E:\Program Files\Rational\Rational Test\sqabas32\sqautil.sbh"
Sub Main
Dim Result As Integer
Dim DP As Long
Dim Dp_Result As Long
Dim username As String
Dim password As String
dim i as integer
StartBrowser "http://html", "WindowTag=WEBBrowser"
'等待5秒钟
i=1
while i<9
' DelayFor (5000)
'检查页面是否装载成功
Result = WindowVP (Exists, "Caption=系统平台 - Microsoft Internet Explorer", "VP=Window Existence;Wait=2,5")
if Result<>1 then
sqaconsolewrite "页面加载失败!!"
else
sqaconsolewrite "页面加载成功!!!"
'最大化窗口
Window SetContext, "Caption=系统平台 - Microsoft Internet Explorer", ""
Window WMaximize, "", ""
Browser NewPage,"HTMLTitle=系统平台",""
'在用户/密码框输入内容并敲击键盘上的回车
EditBox Click, "Name=j_username", "Coords=36,4"
DP = SQADatapoolOpen ("users")
call SQADatapoolFetch(DP)
call SQADatapoolvalue(DP,1,username)
call SQADatapoolvalue(DP,2,password)
call SQADatapoolFetch(DP)
call SQADatapoolClose(DP)
inputKeys username &"{TAB}"& password &"{ENTER}"
end if
wend
[ Last edited by 生如火花 on 2005-4-1 at 16:39 ] 楼主的整个代码 逻辑有问题!
请确认,跟踪调试代码,然后梳理思路! -----------------------------------
call SQADatapoolFetch(DP)
call SQADatapoolvalue(DP,1,username)
call SQADatapoolvalue(DP,2,password)
call SQADatapoolFetch(DP)'//(多余的!!)
call SQADatapoolClose(DP)
------------------------------------
除了多余的一行外,建议将open 数据池 及 close 放在循环之外。
页:
[1]