|
Dim hint_msg
Dim hint
Dim ActualDialogPopup
InvokeApplication "D:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
' 参数化user和password值
Dialog("Login").WinEdit("Agent Name:").Set DataTable("user", dtGlobalSheet)
Dialog("Login").WinEdit("Password:").Set DataTable("password", dtGlobalSheet)
Dialog("Login").WinButton("OK").Click
hint = DataTable("hint", dtGlobalSheet)
' 判断弹出错误提示框的正确性,如果输入了正确密码,而用户名又大于4个字符则不弹出错误提示框,否则弹出错误提示框。
If Dialog("Login").Dialog("Flight Reservations").Exist then
ActualDialogPopup = "TRUE"
else
ActualDialogPopup = "FALSE"
end if
ExpectedDialogPopup = DataTable("ExpectedDialogPopup", dtGlobalSheet)
If (ActualDialogPopup = ExpectedDialogPopup) then
Reporter.ReportEvent micpass, "登陆", "程序判断正确."
' 如果弹出错误提示框,通过对比hint
If ActualDialogPopup = "TRUE" Then
hint_msg = Dialog("Login").Dialog("Flight Reservations").Static("Static").GetROProperty("text")
If (hint = hint_msg) Then
Reporter.ReportEvent micpass, "登陆错误提示", "错误提示信息正确."
else
Reporter.ReportEvent micFail, "登陆错误提示", "错误提示信息错误."
End if
Dialog("Login").Dialog("Flight Reservations").WinButton("确定").Click
Dialog("Login").Close
else
Window("Flight Reservation").Close
End If
else
Reporter.ReportEvent micfail, "登陆", "程序判断错误."
If ActualDialogPopup = "TRUE" Then
Dialog("Login").Dialog("Flight Reservations").Close
Dialog("Login").Close
else
Window("Flight Reservation").Close
end if
End If
[ 本帖最后由 scanli100 于 2006-8-27 21:43 编辑 ] |
|