实验目标:1,学习会设置检查点
2,学会脚本录制的基本方法
实验工具:HP HP Unified Functional Testing
Flight软件
第一步:登录系统
'登录系统'
Systemutil.Run "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\HP Software\HP Unified Functional Testing\Sample Applications\Flight GUI" @@ hightlight id_;_3015090_;_script infofile_;_ZIP::ssf2.xml_;_
Dialog("Login").WinEdit("Agent Name:").Set "mercury" @@ hightlight id_;_852454_;_script infofile_;_ZIP::ssf3.xml_;_
Dialog("Login").WinEdit("Password:").SetSecure "561f11087058caba910fe95d4d9d468995859f7b" @@ hightlight id_;_590398_;_script infofile_;_ZIP::ssf4.xml_;_
@@ hightlight id_;_65900_;_script infofile_;_ZIP::ssf6.xml_;_
Dialog("Login").WinButton("Help").Click @@ hightlight id_;_133582_;_script infofile_;_ZIP::ssf7.xml_;_
'检查MERCURY是否显示在’ ’之间'
Dialog("Login").Dialog("Flight Reservations").Static("The password is 'MERCURY'").Check CheckPoint("The password is 'MERCURY'") @@ hightlight id_;_461298_;_script infofile_;_ZIP::ssf9.xml_;_
Dialog("Login").Dialog("Flight Reservations").WinButton("确定").Click @@ hightlight id_;_723448_;_script infofile_;_ZIP::ssf10.xml_;_
@@ hightlight id_;_133630_;_script infofile_;_ZIP::ssf8.xml_;_
Dialog("Login").WinButton("OK").Click
第二步:订票
Window("Flight Reservation").ActiveX("MaskEdBox").Type "121215" @@ hightlight id_;_328772_;_script infofile_;_ZIP::ssf2.xml_;_
Window("Flight Reservation").WinComboBox("Fly From:").Select DataTable("p_Item1", dtGlobalSheet) @@ hightlight id_;_787120_;_script infofile_;_ZIP::ssf3.xml_;_
Window("Flight Reservation").WinComboBox("Fly To:").Select DataTable("p_Item", dtGlobalSheet) @@ hightlight id_;_656214_;_script infofile_;_ZIP::ssf4.xml_;_
Window("Flight Reservation").WinButton("FLIGHT").Click @@ hightlight id_;_656176_;_script infofile_;_ZIP::ssf6.xml_;_
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click @@ hightlight id_;_1049460_;_script infofile_;_ZIP::ssf7.xml_;_
'检查程序中图片里的自由女神像部分是否正常出现'
Window("Flight Reservation").Static("Static").Check CheckPoint("Static")
Window("Flight Reservation").WinEdit("Name:").Set "xiao" @@ hightlight id_;_655934_;_script infofile_;_ZIP::ssf8.xml_;_
Window("Flight Reservation").WinRadioButton("First").Set @@ hightlight id_;_917990_;_script infofile_;_ZIP::ssf9.xml_;_
Window("Flight Reservation").WinButton("Insert Order").Click
'检查新生成的订单号Order No是否为正整数'
Window("Flight Reservation").WinEdit("Order No:").Check CheckPoint("Order No:") @@ hightlight id_;_68358_;_script infofile_;_ZIP::ssf13.xml_;_
'获得对象库里面的内容'
'cdbl()将字符串转换成double型'
price =cdbl(mid( Window("Flight Reservation").WinEdit("Price:").GetVisibleText,2))'获得price里面的内容'
Tickets =cdbl ( Window("Flight Reservation").WinEdit("Tickets:").GetROProperty("text"))'获得tickets里面的内容'
Total = cdbl(mid(Window("Flight Reservation").WinEdit("Total:").GetVisibleText,2))'获得total里面的内容'
If abs(price*tickets-total)<0.00000000001 Then '判断是否相等'
Reporter.ReportEvent micPass,"判断是否相等","相等"
else
Reporter.ReportEvent micPass,"判断是否相等","不相等"
End If
第三步:退出系统
'关闭窗口'
Window("Flight Reservation").Close