QTP的飞机登录描述性编程

Olga ·
更新时间:2024-09-21
· 985 次阅读

  在QTP中,要先去录制用户名和密码,错误的一次和正确的一次,对于错误所弹出的对话框要进行建立文本的检查点,以便datatable的用例进行比对。用户名和密码要进行参数化,在进行判断。 Dim url url="C:Program FilesMercury InteractiveQuickTest Professionalsamplesflightappflight4a.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



qtp

需要 登录 后方可回复, 如果你还没有账号请 注册新账号