直接描述性编程——客户端飞机订票系统

来源:互联网 发布:淘宝开店充话费赚钱吗 编辑:程序博客网 时间:2024/05/28 16:14

Login:

 SystemUtil.Run "C:\Program Files (x86)\HP\Unified Functional Testing\samples\flight\app\flight4a.exe"
With Dialog("text:=Login")
    .WinEdit("attached text:=Agent Name:").Set "merc"
    .WinEdit("attached text:=Password:").Set "mercury"
    .WinButton("regexpwndtitle:=OK").Click
End With

New Order:

With Window("regexpwndtitle:=Flight Reservation")
    .WinButton("window id:=6").Click
    .ActiveX("progid:=MSMask\.MaskEdBox\.1").Type DataTable("Data", dtGlobalSheet)
    
    .WinComboBox("attached text:=Fly From:").Select DataTable("FlyFrom", dtGlobalSheet)
    .WinComboBox("attached text:=Fly To:").Select DataTable("FlyTo", dtGlobalSheet)
    .WinButton("regexpwndtitle:=FLIGHT").Click
    
    Dialog("text:=Flights Table").WinButton("regexpwndtitle:=OK").Click
    .WinEdit("window id:=1014").Set DataTable("Name", dtGlobalSheet)
    
    a=DataTable("Class", dtGlobalSheet)
    If  a = "经济舱" Then
    .WinRadioButton("text:=Economy").Click
    elseIf a="商务舱" Then 
    .WinRadioButton("text:=Business").Click    
    Else
    .WinRadioButton("text:=First").Click    
    End If
    
    '.WinRadioButton("text:="&DataTable("Class", dtLocalSheet)).Click

    .WinButton("text:=&Insert Order").Click
    
    'Order No
    wait(5)
    Dim t
    t=.WinEdit("attached text:=Order No:").GetROProperty("text")
    DataTable.Value("Order_No",dtGlobalSheet)=t
    End With

OpenOrder:

 Window("regexpwndtitle:=Flight Reservation").WinButton("window id:=5").Click
With Window("regexpwndtitle:=Flight Reservation").Dialog("text:=Open Order")
    .WinCheckBox("text:=Customer &Name").Click
    .WinEdit("window id:=1014").set DataTable("Name", dtGlobalSheet)
    .WinCheckBox("regexpwndtitle:=&Flight Date").Click
    .ActiveX("progid:=MSMask\.MaskEdBox\.1").Type DataTable("Data", dtGlobalSheet)
    .WinButton("text:=OK").Click

'选择最新定的票
Dim list
    list=.Dialog("text:=Search Results").WinList("attached text:=Flight No\.").GetROProperty("items count")
    .Dialog("text:=Search Results").WinList("attached text:=Flight No\.").Select(list-1)
    .Dialog("text:=Search Results").WinButton("text:=OK").Click
    End With
'检查打开的订单的订单号与创建订单时生成的订单号是否一致
Dim a,b
a=Window("text:=Flight Reservation").WinEdit("window id:=1016").GetROProperty("text")
b=DataTable.Value("Order_No",dtGlobalSheet)
If a=b Then
    Reporter.ReportEvent micPass, "相等""被打开的订单的订单号与创建订单时生成的订单号一致"
else
    Reporter.ReportEvent micFail, "不相等""被打开的订单的订单号与创建订单时生成的订单号不一致"
End If

Logout:

 Window("regexpwndtitle:=Flight Reservation").Close

0 0
原创粉丝点击