QTP的飞机登录描述性编程

QTP中,要先去录制用户名和密码,错误的一次和正确的一次,对于错误所弹出的对话框要进行建立文本的检查点,以便datatable的用例进行比对。用户名和密码要进行参数化,在进行判断。
Dim url
url="C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
if Dialog("text:=Login").Exist(1) then
OptionalStep.Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set DataTable("p_Text", dtGlobalSheet)
OptionalStep.Dialog("text:=Login").WinEdit("attached text:=Password:").Set DataTable("p_Text1", dtGlobalSheet)
OptionalStep.Dialog("text:=Login").WinButton("text:=OK").Click
wait(1)
else
  如果QTP不能自己打开被 测试程序就使用该功能打开
systemUtil.Run url
OptionalStep.Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set DataTable("p_Text", dtGlobalSheet)
OptionalStep.Dialog("text:=Login").WinEdit("attached text:=Password:").Set DataTable("p_Text1", dtGlobalSheet)
OptionalStep.Dialog("text:=Login").WinButton("text:=OK").Click
wait(1)
end if
  检查点
if Dialog("text:=Login").Dialog("text:=Flight Reservations").Exist(2)  then
dim  errorinfor,odesc
set desc=description.Create
odesc("text").value=DataTable("error",dtGlobalSheet)
errorinfor=Dialog("text:=Login").Dialog("text:=Flight Reservations").Static(odesc).GetROProperty("text")
Dialog("text:=Login").Dialog("text:=Flight Reservations").WinButton("text:=确定").Click
   学习一下Reporter方法的用法
Reporter.ReportEvent micDone,"登陆验证失败,提示信息如下",errorinfor
OptionalStep.Dialog("text:=Login").close
wait(1)
else
  如果用户名和密码正确就进入订票页面
If Window("text:=Flight Reservation").Exist(10) then
Reporter.ReportEvent micPass,"登陆验证通过","用户名密码正确"
Window("text:=Flight Reservation").close
wait(1)
Set desc=Nothing
end if
end if

飞机登录描述性编程图片
  测试结果


最新内容请见作者的GitHub页:http://qaseven.github.io/

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值