测试用例:
username status 期望结果
liming status为空,登录成功
Please enter agent name status不为空,结果报告显示Please enter agent name
yuan status为空,登录成功
li Agent name must be at least 4 characters long. status不为空,结果报告显示Agent name。。
yuan1 status为空,登录成功
注:status的内容根据Flight Reservations界面的信息。
Flight Reservations错误界面(如密码错误时),GetROProperty("Text")根据用户名、密码输入的不同动态得到Text的内容。Flight Reservations是错误界面 Flight Reservation是登录成功界面
Dim istatus
Dim text1
SystemUtil.Run "D:/Program Files/Mercury Interactive/QuickTest Professional/samples/flight/app/flight4a.exe"
Dialog("Login").WinEdit("Agent Name:").Set DataTable("p_Text", dtGlobalSheet)
Dialog("Login").WinEdit("Password:").SetSecure "482a67de313480a4f613a9f60fbd2a8651b05396"
istatus=DataTable("status",dtGlobalSheet)
Dialog("Login").WinButton("OK").Click
If Dialog("Login").Dialog("Flight Reservations").Exist Then //判断第三方界面是否存在,即错误警告界面
text1=Dialog("Login").Dialog("Flight Reservations").Static("Incorrect password. Please").GetROProperty("Text") //存在获取界面的Text值赋予text1
if text1= istatus then //如果Text是预期结果的值,打印text1
Reporter.ReportEvent micPass, "失败",text1
else
Reporter.ReportEvent micFail,"异常","有错误" // 否则异常
end if
wait(2) //可有可无
Dialog("Login").Dialog("Flight Reservations").WinButton("确定").Click //关掉错误警告界面
Dialog("Login").WinButton("Cancel").Click //关掉本次登录界面,便于下一个循环
else
Reporter.ReportEvent micPass, "成功","登录成功" //错误警告界面不存在,则登录成功
Window("Flight Reservation").Close
End If