QTP的飞机登录描述性编程

上一篇 / 下一篇  2013-11-05 16:54:12 / 天气: 晴朗 / 心情: 高兴 / 精华(3) / 置顶(3) / 个人分类: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

 


TAG:

xiaoxiaoimg的个人空间 引用 删除 xiaoxiaoimg   /   2013-11-08 17:24:09
fuhao的个人空间 引用 删除 fuhao   /   2013-11-07 16:56:14
51Testing小编的个人空间 引用 删除 zaza9084   /   2013-11-06 14:27:15
您好,我是51Testing软件测试网的编辑,您的本篇博文近日将被推荐至51Testing软件测试网首页发表~
感谢您关注并支持51Testing博客,期待您更多的优秀原创博文。
 

评分:0

我来说两句

日历

« 2024-04-24  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 4436
  • 日志数: 9
  • 建立时间: 2013-02-26
  • 更新时间: 2013-11-05

RSS订阅

Open Toolbar