《QTP实验指导2.doc》由会员分享,可在线阅读,更多相关《QTP实验指导2.doc(28页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-dateQTP实验指导2实验二 检查点与捕捉动态信息天津工业大学实验指导书时间: 年 月 日课程名称:软件测试技术实验名称:QTP检查点与脚本循环设计班级: 姓名: 学号: 指导教师评定: 签名: 1 实验目的(1)理解和掌握自动化测试的基本原理和方法。(2)掌握QTP标准检查点的设置方法。(3)掌握QTP动态捕捉信息与循环脚本的设计的方法。2 实验要求(1)使用QTP对订票
2、程序的Insert order功能进行测试,验证订票是否成功。(2)掌握在QTP中检查点的添加方法。(3)使用QTP对被测程序进行动态信息捕捉的操作。(4)掌握对测试脚本中取出多个值进行循环脚本的设计。3 实验内容(1)录制并生成订票脚本,按照三种方式来添加检查点,通过对update order按钮、delete order按钮、Insert Done按钮和Order No:文本框的属性进行验证,来判断订票是否成功;(2)在订票脚本的基础上,通过设计循环脚本,动态取出“出发地”和“目的地”的所有航班,并测试程序是否正确。4 实验步骤(1)录制脚本:成功登陆订票窗口在订票系统中输入航班日期选择起
3、飞地点选择目的地选择航班输入顾客姓名输入票的张数选择航班级别单击订票按钮;(2)在日期栏输入 123112,选择起始和目的地点:Denver和Frankfurt,选择航班号15819,确定订单中的航班,输入订票姓名”zhangsan”,订票张数是2张,航班选择first,确定当前订票信息,单击”insert order”按钮。(3)脚本录制完成后,脚本及订单图如下所示:Dialog(Login).WinEdit(Agent Name:).Set testDialog(Login).WinEdit(Password:).SetSecure 4f669b9da99a7e76169a9134e948
4、b20c8a2f4edcDialog(Login).WinButton(OK).ClickWindow(Flight Reservation).WinMenu(Menu).Select File;New OrderWindow(Flight Reservation).ActiveX(MaskEdBox).Type 123112Window(Flight Reservation).WinComboBox(Fly From:).Select DenverWindow(Flight Reservation).WinComboBox(Fly To:).Select FrankfurtWindow(Fl
5、ight Reservation).WinButton(FLIGHT).ClickWindow(Flight Reservation).Dialog(Flights Table).WinList(From).Select 15889 DEN 03:12 PM FRA 03:57 PM AA $104.10Window(Flight Reservation).Dialog(Flights Table).WinButton(OK).ClickWindow(Flight Reservation).WinEdit(Name:).Set zhangsanWindow(Flight Reservation
6、).WinEdit(Tickets:).Set 2Window(Flight Reservation).WinRadioButton(First).SetWindow(Flight Reservation).WinButton(Insert Order).Click(4)回访脚本,检查脚本的正确性;(5)在Active Screen中,用右键单击”Update Order”按钮,添加标准检查点,检查”Update Order”按钮的enabled属性值。如下图所示:(6)点击OK按钮,打开checkpoint设置窗口,选择enabled属性,在Configure Value中,选择Consta
7、nt,输入enabled属性的预期值为True,选”After current step”,点击“OK”,如下图所示:(7)增加完检查点后,脚本在keyword视图下,如下图所示:(8)脚本在expert view下,如下所示:Dialog(Login).WinEdit(Agent Name:).Set testDialog(Login).WinEdit(Password:).SetSecure 4f669b9da99a7e76169a9134e948b20c8a2f4edcDialog(Login).WinButton(OK).ClickWindow(Flight Reservation).
8、WinMenu(Menu).Select File;New OrderWindow(Flight Reservation).ActiveX(MaskEdBox).Type 123112Window(Flight Reservation).WinComboBox(Fly From:).Select DenverWindow(Flight Reservation).WinComboBox(Fly To:).Select FrankfurtWindow(Flight Reservation).WinButton(FLIGHT).ClickWindow(Flight Reservation).Dial
9、og(Flights Table).WinList(From).Select 15889 DEN 03:12 PM FRA 03:57 PM AA $104.10Window(Flight Reservation).Dialog(Flights Table).WinButton(OK).ClickWindow(Flight Reservation).WinEdit(Name:).Set zhangsanWindow(Flight Reservation).WinEdit(Tickets:).Set 2Window(Flight Reservation).WinRadioButton(First
10、).SetWindow(Flight Reservation).WinButton(Insert Order).ClickWindow(Flight Reservation).WinButton(Update Order).Check CheckPoint(Update Order)(9)回放脚本,查看检查点的检查结果,测试报告是否显示为passed;(10)在expert view下,将鼠标放置到 checkpoint(“update order”)上,右键点击鼠标,选择checkpoint properties,再次打开检查点属性设置窗口,选择enabled属性,在Configure Va
11、lue中,选择Constant,输入enabled属性的预期值为False,如下图所示:(11)重新回访脚本,查看此时的测试报告是否为Failed,并检查是否有出错的截图。(12)对delete order按钮和Insert Done按钮按照以上的步骤,设置标准检查点,验证enabled属性是否为正确的值;对delete order按钮当enable属性设置为false时,结果如下所示:当对delete order按钮当enable属性设置为true时,结果如下所示:对Insert Done按钮当enable属性设置为true时,结果如下所示:对Insert Done按钮当enable属性设置
12、为false时,结果如下所示:(13)将下列取值,用循环脚本实现:Dim Str_FlyFrom,Str_FlyTo,Str_FlightDim Int_FlyFrom,Int_FlyTo,Int_FlightDim i,j,kInt_FlyFrom=Window(Flight Reservation).WinComboBox(Fly From:).GetItemsCountFor i=0 to Int_FlyFrom-1Str_FlyFrom = Window(Flight Reservation).WinComboBox(Fly From:).GetItem(i)Window(Flight
13、 Reservation).WinComboBox(Fly From:).Select Str_FlyFromInt_FlyTo = Window(Flight Reservation).WinComboBox(Fly To:).GetItemsCountFor j=0 to Int_FlyTo-1Str_FlyTo = Window(Flight Reservation).WinComboBox(Fly To:).GetItem(j)Window(Flight Reservation).WinComboBox(Fly To:).Select Str_FlyToWindow(Flight Re
14、servation).WinButton(FLIGHT).ClickInt_Flight = Window(Flight Reservation).Dialog(Flights Table).WinList(From).GetItemsCountFor k=0 to Int_Flight-1If k0 ThenWindow(Flight Reservation).WinMenu(Menu).Select File;New OrderWindow(FlightReservation).ActiveX(MaskEdBox).Type 121212Window(Flight Reservation)
15、.WinComboBox(Fly From:).Select Str_FlyFromWindow(Flight Reservation).WinComboBox(Fly To:).Select Str_FlyToWindow(Flight Reservation).WinButton(FLIGHT).ClickInt_Flight=Window(FlightReservation).Dialog(Flights Table).WinList(From).GetItemsCountFor k=0 to Int_Flight-1Str_Flight = Window(Flight Reservation).Dialog(Flights Table).WinList(From).GetItem(k)Window(FlightReservation).Dialog(Flights Table).WinList(From).Select Str_FlightWindow(FlightReservation).Dialog(Flights Table).WinButton(OK).ClickNextNextNext-