大家好,又见面了,我是你们的朋友全栈君。
SystemUtil.Run”C:\ProgramFiles(x86)\HP\UnifiedFunctionalTesting\samples\flight\app\flight4a.exe”
使用Systemutil.Run打开订票程序
Dialog(“Login”).WinEdit(“AgentName:”).Set “mercury”
输入代理名称“mercury”
Dialog(“Login_2”).WinButton(“Help”).Click
点击Help按钮
Dialog(“Login_2”).Dialog(“FlightReservations”).Static(“The password is ‘MERCURY'”).CheckCheckPoint(“The password is ‘MERCURY'”)
在01_Login中添加文本检查点检查MERCURY是否显示在’’之间
Dialog(“Login_2”).Dialog(“FlightReservations”).WinButton(“确定“).Click
关闭Help对话框
Dialog(“Login”).WinEdit(“Password:”).SetSecure”5624a3762a03a45a9b60bcbe70201011e9a73323″
输入密码
Dialog(“Login”).WinButton(“OK”).Click
点击登录
Window(“FlightReservation”).Activate
Window(“FlightReservation”).ActiveX(“MaskEdBox”).Type “102715”
选择日期
Window(“Flight Reservation”).WinComboBox(“FlyFrom:”).Select “Frankfurt”
选择出发地“Frankfurt”
Window(“FlightReservation”).WinComboBox(“Fly To:”).Select “LosAngeles”
选择目的地“Los Angeles”
Window(“FlightReservation”).WinButton(“FLIGHT”).Click
点击“FLIGHT”按钮
Window(“FlightReservation”).Dialog(“FlightsTable”).WinButton(“OK”).Click
选择一种票价
Window(“FlightReservation”).WinEdit(“Name:”).Set “jzm”
输入订票人姓名
Window(“FlightReservation”).WinEdit(“Tickets:”).Set “2”
输入票数
Window(“FlightReservation”).WinButton(“Insert Order”).Click
点击“Insert Order”
Window(“FlightReservation”).WinEdit(“Order No:”).Check CheckPoint(“OrderNo:”)
在“Order No:”设立标准检查点
p=Window(“FlightReservation”).WinEdit(“Price:”).GetROProperty(“text”)
p1=mid(p,2)
num=Window(“FlightReservation”).WinEdit(“Tickets:”).GetROProperty(“text”)
t=Window(“FlightReservation”).WinEdit(“Total:”).GetROProperty(“text”)
t1=mid(t,2)
If abs(t1-p1*num)<0.0001 Then
reporter.ReportEventmicPass,”票价检查“,”总价计算正确“
else
reporter.ReportEventmicFail,”票价检查“,”总价计算不正确“
End If
采用自定义检查点,检查Price*Ticket的价格是否等于Total,并用if语句写出判定成功或者失败后的Reporter.ReportEvent报告语句
Window(“FlightReservation”).WinMenu(“Menu”).Select “Help;About…”
Window(“FlightReservation”).Dialog(“About Flight Reservation”).CheckCheckPoint(“About Flight Reservation System”)
Window(“FlightReservation”).Dialog(“About FlightReservation”).WinButton(“OK”).Click
Window(“FlightReservation”).Activate
Window(“FlightReservation”).Close
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/140377.html原文链接:https://javaforall.cn