实验四+108+曾宏宇

一、实验目的

   1) 学习QTP工具的使用

   2)了解黑盒自动化测试

二、实验要求

(1)对被测程序进行黑盒测试用例设计

(2)对QTP的飞机订票系统的任一界面或控件实现自动化测试。(测试的具体自选)

(3)写出该程序的缺陷。

三、实验内容

 1、对QTP的样例小程序飞机订票系统(3a),实现自动化测试。

 2、(1)登录功能测试

  (2)测试用例

序号 输入 预期结果
用户名 密码
1 登录失败
2 mercury 登录失败
3 user 登录失败
4 use mercu 登录失败
5 user mercury 登录成功
6 user 456789 登录失败
7 /-*/-/* mercury 登录失败
8 user /*/-/*/-* 登录失败

 

 

 

 

 

 

 

 

  (3)测试脚本

Dialog("Login").WinEdit("Agent Name:").Set  DataTable("username", dtGlobalSheet)
Dialog("Login").WinEdit("Password:").Set  DataTable("password", dtGlobalSheett)
Dialog("Login").WinButton("OK").Click
For i = 1 to datatable.GlobalSheet.getrowcount
    datatable.GlobalSheet.setcurrentrow i
If Dialog("Login").Dialog("Flight Reservations").Exist(5) Then
    Dialog("Login").Dialog("Flight Reservations").WinButton("确定").Click
    Reporter.ReportEvent micFail,"登录失败","登录失败"
 else
    Reporter.ReportEvent micPass,"登陆成功","登陆成功"
    Window("Flight Reservation").Close
End If
next
View Code

  (4)测试结果

  测试脚本未能正常执行完成,是因为第5个测试用例执行后,登陆成功,进入window,根据脚本被测系统将被关闭,因此后面的测试脚本将不能正常执行。

3.测试小结

   QTP的自动化测试通过测试人员编写的测试脚本执行测试,能够提高测试的效率。

posted @ 2017-06-25 18:49  Why-Not  阅读(226)  评论(0编辑  收藏  举报