大家帮我看一下
如果用ROBOT结合DATAPOOL,做验证登录的测试,如果密码正确,则关闭系统,提示用例通过,如何跑下一组用户名和密码,用户名和密码错误,提示密码错误,但是用例正确,'$Include "sqautil.sbh"
Sub Main
Dim Result As Integer
dim dp as long
dim i as integer
dim strName as String
dim strPassWord as string
'Initially Recorded: 2007-3-2910:44:03
'Script Name: datapool
StartApplication """xxx.exe"""
dp=SQADatapoolOpen("dp1")' dp1为DATAPOOL的名称,循环读datapool的数据'
for i=1 to 3
call SQADatapoolFetch(dp)
call SQADatapoolValue(dp,1,strName)
call SQADatapoolValue(dp,2,strPassword)
InputKeys strName
inputKeys "{ENTER}"
Inputkeys strPassword
InputKeys "{ENTER}"
Result = WindowVP (Exists, "Class=#32770;Level=6", "VP=Window Existence")'验证出现密码错误的对话框
if result=1 then
msgbox "密码不正确,但是用例正确"
Window SetContext, "Class=#32770;Level=6", ""
InputKeys "{ENTER}"
else
msgbox "密码正确,进入系统,通过测试"
Window SetContext, "Type=Form;Name=FrmLogOff", ""
PushButton Click, "Type=PushButton;Name=btnOK"
'关闭系统
end if
next
call SQADatapoolClose(dp)
end sub
大家帮我看一下有流程对吗?需要那些完善的地方,谢谢 楼主的程序调试过了么?
call SQADatapoolValue(dp,2,strPassword)
InputKeys strName
inputKeys "{ENTER}"
inputkeys 前也没有指定是对哪个控件进行输入? 调试过的,前面已经启动了登录窗口的,会自动的输入的呀。没有语法错误,但是流程好像不对 先把流程用文字写出来,然后翻译成代码,就很清晰了
流程
我想实现的流程就是测试用户登录,循环的度DATAPOOL的数据,如果登录成功,提示正确,进入系统,然后关闭要进入的主页,继续读datapool的下行,密码失败提示密码或这用户名错误,接着走datapool的下行。,版主帮一下忙呀,我这个代码哪写的不对
页:
[1]