|
如果用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-29 10: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
大家帮我看一下有流程对吗?需要那些完善的地方,谢谢 |
|