51Testing软件测试论坛

标题: WinMenu使用描述性编程 [打印本页]

作者: dreamsea123    时间: 2009-1-16 12:01
标题: WinMenu使用描述性编程
WinMenu的描述性编程需要一点小技巧

以flight4.exe中新订一张票为例使用描述性编程



Function Order_Ticket()

Set ōrderPage = Descrīption.Create()
OrderPage("Class Name").Value= "Window"   '设置页面类
OrderPage("Regexpwndtitle").Value="Flight Reservation"
Set DateForm =Descrīption.Create()
DateForm("Class Name").Value="ActiveX"   ''设置ActiveX的属性
DateForm("acx_name").Value="MaskEdBox"  '描述对象名
Set  FromCity = Descrīption.Create()
FromCity ("Class Name").Value="WinComboBox"
FromCity("attached text").Value="Fly From:"
Window(OrderPage).Restore      '还原订票系统   

Window(OrderPage).ActiveX(DateForm).Type "081229"   '输入订票日期
Window(OrderPage).WinComboBox( FromCity).Select "London"
Window(OrderPage).WinComboBox("attached text:=Fly To:").Select "Denver"

''Window(OrderPage).ActiveX(DateForm).Type Parameter("myDate")   '设置参数化订票日期
''Window(OrderPage).WinComboBox( FromCity).Select Parameter("myFrom")' 设置参数化“出发地”
'''Window(OrderPage).WinComboBox("attached text:=Fly To:").Select Parameter("myTo")  '设置参数化“目的地”

Window(OrderPage).WinButton("text:= flight").Click  '查看机票信息
Window(OrderPage).Dialog("text:=Flights Table","Class Name:=Dialog").WinButton("text:=ok").Click   '关闭机票信息窗口
Window(OrderPage).WinEdit("Class Name:=WinEdit","attached text:=Name:").Set"zhangfei" '订票人
Dim rage,i
i=RandomNumber(0,2)
Select Case i
Case "0"
rage="First"
print(rage)
Window(OrderPage).WinRadioButton("Class Name:=WinRadioButton","text:="&rage).Set

Case "1"
rage="Business"
print(rage)
Window(OrderPage).WinRadioButton("Class Name:=WinRadioButton","text:="&rage).Set
Case "2"
  rage="Economy"
  print(rage)
Window(OrderPage).WinRadioButton("Class Name:=WinRadioButton","text:="&rage).Set
End Select  '选择机舱
Window(OrderPage).WinButton("Class Name:=WinButton","text:=&Insert Order").Click
Window(OrderPage).WinMenu("menuobjtype:=&2").Select "File;New Order" '再新订一张票,描述性编程
End Function

Call Order_Ticket()



WinMemu的描述性编程:WinMenu("menuobjtype:=&2")超级简单,就是需要一点技巧
作者: lingxin5013    时间: 2009-1-17 16:32
呵呵 你还要加油啊
现在论坛QTP进展已经不在你那拉
作者: kaidong12    时间: 2009-8-19 21:13
WinMenu("menuobjtype:=&2") 对吗?




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2