1、软件测试案例分析 实验三LoadRunner检查点DOC南昌航空大学实验报告 2013/06/06 课程名称: 软件测试案例分析 实验名称: LoadRunner检查点 班级: 姓名: 同组人: 指导教师评定: 签名: 一、 实验目的(1)理解和掌握性能测试的基本原理和方法。(2)掌握LR检查点的使用与脚本设计。二、实验要求(1)运用LR录制订票操作的脚本。(2)回放脚本,观察结果。(3)对订票的金额设置检查点。三、实验内容(一)、使用LR录制mercury tours订票系统订票操作的脚本。具体步骤如下:(1)打开LR的录制配置窗口,将登陆页面的脚本录制到vuser_init动作中(确认将W
2、inxp系统的防火墙关闭)。如下图所示:(2)开始录制,打开http:/localhost/MercuryWebTours/订票页面,选择用户jojo/bean,或者joe/young登陆订票系统,如下图所示;(3)重新选择recording窗口的动作下拉列表,将以下的操作录制到action动作中;(4)继续录制操作,点击flights按钮,进入订票窗口,选择Departure City为Frankfurt,Arrival City为London, No of Passengers为1,其他为默认设置,如下图所示:(5)点击continue按钮,继续录制,进入航班选择页面,选择起飞时间为8am
3、的航班,如下图所示:(6)点击continue按钮,继续录制,进入信用卡支付页面,如下图所示:(7)在credit card中输入 5602 4506 2220,Exp Date输入08/16,点击purchase flight按钮。进入机票确认窗口。如下图所示:(8)订票结束,点击sign off按钮返回登录页面。(二)、下面通过设置检查点函数来检查页面中的相关信息,步骤如下:(1)使用web_find()函数,来检查登录成功以后的欢迎页面是否是以“Welcome”开始的。如下图所示:函数作用:在页面中查找相应的内容参数举例:web_find(web_find,RighOf=a,LeftOf
4、=b,What=name,LAST);参数解释:web_find定义该查找函数的名称;“LeftOf”和“RighOf=”用来定义查找字符的左右边界;“What=”定义查找内容。例如上述参数举例中的意思就是在页面中查找左边界为b,右边界为a,内容为name的信息函数用法:该函数是在查找页面中的内容,所以要放在要查找的内容的后面。注意事项:使用该函数时,要在Vuser-Run-Tme Settings中更改下设置勾选Enable Image and text check系统默认是不勾选该选项的。关于该函数的其他说明:该函数只能在基于HTML模式录制的脚本中进行查找。(2)由于欢迎页面“Welco
5、me”的右侧是逗号“,”,所以在VUGen中,将script view切换为Tree view,在vuser_init动作中,选择submit form:login.pl,鼠标右键单击选择insert after,如下图所示:(3)在插入窗口中展开web checks,选择Text Check,选择ok,如下图所示:(4)选择OK以后,在Text Check Properties的设置窗口中,输入Search for为Welcome,选中Left of,表示应在某文本的左边出现,输入逗号”,”,点击确定。(5)将VUGen返回script view视图,此时在Vuser_init中可以查看到插
6、入的文本检查点脚本。如下图所示:(6)由于web_find是在页面中查找文本是否出现,最好在web_submit_form的脚本后插入thinktime,保证等待页面打开后再来查找检查点的文本,因此修改脚本如下所示:(7)脚本确认以后,回放脚本,查看execution Log,能发现如下的日志“web_find successful. 1 occurrence(s) of “Welcome” found”,表示检查点执行正确: (三)若检查订单确认页面的“Total cost”是否为266,请录制脚本设置检查点。(四)在订票系统登录后,将显示欢迎的页面,具体页面如下:在该页面中,如果以joe登
7、陆,则在页面中将显示welcome,joe,.,如何检查系统是否显示了当前登陆的用户?此时,可以通过带参数的web_find函数来检查。(1) 新建一个新的LR脚本文件,重新录制订票系统的登陆脚本(由于该脚本将循环执行,所以应录制到action动作中),并将用户名和密码参数化,其中用户名和密码如下所示(注意存储数据的文件名为username.dat): Username Password joe young jojo bean(2) 在tree view视图下,选择submit form,在右键菜单中选择”Insert After”,插入检查函数web_find;(3)在插入窗口中展开web
8、checks,选择Text Check,选择ok,如下图所示:(4)选择OK按钮后,在Text Check Properties窗口的search for文本框中选择,按钮abc,表示将要搜索的文本参数化, (5)在弹出的select or create parameter的窗口中,输入parameter name 为username,点击proerties按钮,在弹出的参数属性窗口中,选择file path 为之前参数的数据文件username.dat. 在select column中选择1,表示从数据文件的第一列取数据。(6)设置完成后,点击close,点击确定,返回web_found的设
9、置窗口,如下图所示:(7)在left of 文本框中输入逗号”,”,点击确定。(8)点击确定后,返回到script view,能查看到插入的web_find函数。(9)在script view视图中,选择action,右键点击选择runtime settings,如下图所示:(10)在run logic中设置循环次数为2,点击确定。(11)在preferences中,勾选Enable Image and text check系统默认是不勾选该选项的。(12)回放脚本,在excution log中,能发现两个用户名都带入并且在页面中存在。(13)将参数的数据文件加入一组新的用户名和密码:tom/
10、mountain,将循环次数设置为3,重新运行脚本,观察结果。将脚本和报告以及执行日志保存到实验报告。脚本: URL=http:/localhost/MercuryWebTours/, Resource=0, RecContentType=text/html, Referer=, Snapshot=t1.inf, Mode=HTML, LAST); web_submit_form(login.pl, Snapshot=t2.inf, ITEMDATA, Name=username, Value=username, ENDITEM, Name=password, Value=password,
11、ENDITEM, Name=login.x, Value=58, ENDITEM, Name=login.y, Value=13, ENDITEM, LAST); web_find(web_find, LeftOf=, What=username, LAST); web_image(SignOff Button, Alt=SignOff Button, Snapshot=t3.inf, LAST); return 0;执行日志:Virtual User Script startedStarting action vuser_init.Web Turbo Replay of LoadRunner
12、 7.80.0 for WINXP; Web build 2271 MsgId: MMSG-27143Run-Time Settings file: C:Documents and SettingsAdministratorLocal SettingsTempnoname1default.cfg MsgId: MMSG-27141Ending action vuser_init.Running Vuser.Starting iteration 1.Starting action Action.Action.c(6): Detected non-resource http:/localhost/
13、MercuryWebTours/header.html in http:/localhost/MercuryWebTours/ MsgId: MMSG-26574Action.c(6): Detected non-resource http:/localhost/MercuryWebTours/welcome.pl?signOff=true in http:/localhost/MercuryWebTours/ MsgId: MMSG-26574Action.c(6): Found resource http:/localhost/MercuryWebTours/images/banner_a
14、nimated.gif in HTML http:/localhost/MercuryWebTours/header.html MsgId: MMSG-26659Action.c(6): Detected non-resource http:/localhost/MercuryWebTours/nav.pl?in=home in http:/localhost/MercuryWebTours/welcome.pl?signOff=true MsgId: MMSG-26574Action.c(6): Detected non-resource http:/localhost/MercuryWeb
15、Tours/home.html in http:/localhost/MercuryWebTours/welcome.pl?signOff=true MsgId: MMSG-26574Action.c(6): Found resource http:/localhost/MercuryWebTours/images/banner_merctur.jpg in HTML http:/localhost/MercuryWebTours/home.html MsgId: MMSG-26659Action.c(6): Found resource http:/localhost/MercuryWebT
16、ours/images/sun_swede.gif in HTML http:/localhost/MercuryWebTours/nav.pl?in=home MsgId: MMSG-26659Action.c(6): Found resource http:/localhost/MercuryWebTours/images/login.gif in HTML http:/localhost/MercuryWebTours/nav.pl?in=home MsgId: MMSG-26659Action.c(6): Found resource http:/localhost/MercuryWe
17、bTours/images/signup.gif in HTML http:/localhost/MercuryWebTours/nav.pl?in=home MsgId: MMSG-26659Action.c(6): Found resource http:/localhost/MercuryWebTours/images/admin.gif in HTML http:/localhost/MercuryWebTours/nav.pl?in=home MsgId: MMSG-26659Action.c(6): web_url was successful, 51016 body bytes,
18、 2125 header bytes MsgId: MMSG-27176Action.c(15): Submitting form to http:/localhost/MercuryWebTours/login.pl, Target Frame=body MsgId: MMSG-27978Action.c(15): Detected non-resource http:/localhost/MercuryWebTours/nav.pl?page=menu&in=home in http:/localhost/MercuryWebTours/login.pl MsgId: MMSG-26574
19、Action.c(15): Detected non-resource http:/localhost/MercuryWebTours/login.pl?intro=true in http:/localhost/MercuryWebTours/login.pl MsgId: MMSG-26574Action.c(15): Found resource http:/localhost/MercuryWebTours/images/sun_with_logo.gif in HTML http:/localhost/MercuryWebTours/nav.pl?page=menu&in=home
20、MsgId: MMSG-26659Action.c(15): Found resource http:/localhost/MercuryWebTours/images/flights.gif in HTML http:/localhost/MercuryWebTours/nav.pl?page=menu&in=home MsgId: MMSG-26659Action.c(15): Found resource http:/localhost/MercuryWebTours/images/itinerary.gif in HTML http:/localhost/MercuryWebTours
21、/nav.pl?page=menu&in=home MsgId: MMSG-26659Action.c(15): Found resource http:/localhost/MercuryWebTours/images/in_home.gif in HTML http:/localhost/MercuryWebTours/nav.pl?page=menu&in=home MsgId: MMSG-26659Action.c(15): Found resource http:/localhost/MercuryWebTours/images/signoff.gif in HTML http:/l
22、ocalhost/MercuryWebTours/nav.pl?page=menu&in=home MsgId: MMSG-26659Action.c(15): Resource http:/localhost/MercuryWebTours/images/banner_merctur.jpg is in the cache already and will not be downloaded again MsgId: MMSG-26655Action.c(15): web_submit_form was successful, 12483 body bytes, 1693 header by
23、tes MsgId: MMSG-27176Action.c(23): web_find successful. 1 occurrence(s) of jojo found (RightOf=, LeftOf=,) MsgId: MMSG-27196Action.c(23): web_find was successful MsgId: MMSG-27182Action.c(28): Image-linking to http:/localhost/MercuryWebTours/welcome.pl?signOff=1, Target Frame=body MsgId: MMSG-27993A
24、ction.c(28): Detected non-resource http:/localhost/MercuryWebTours/nav.pl?in=home in http:/localhost/MercuryWebTours/welcome.pl?signOff=1 MsgId: MMSG-26574Action.c(28): Detected non-resource http:/localhost/MercuryWebTours/home.html in http:/localhost/MercuryWebTours/welcome.pl?signOff=1 MsgId: MMSG
25、-26574Action.c(28): Resource http:/localhost/MercuryWebTours/images/banner_merctur.jpg is in the cache already and will not be downloaded again MsgId: MMSG-26655Action.c(28): Resource http:/localhost/MercuryWebTours/images/sun_swede.gif is in the cache already and will not be downloaded again MsgId:
26、 MMSG-26655Action.c(28): Resource http:/localhost/MercuryWebTours/images/login.gif is in the cache already and will not be downloaded again MsgId: MMSG-26655Action.c(28): Resource http:/localhost/MercuryWebTours/images/signup.gif is in the cache already and will not be downloaded again MsgId: MMSG-2
27、6655Action.c(28): Resource http:/localhost/MercuryWebTours/images/admin.gif is in the cache already and will not be downloaded again MsgId: MMSG-26655Action.c(28): web_image was successful, 2368 body bytes, 652 header bytes MsgId: MMSG-27176Ending action Action.Ending iteration 1.Starting iteration
28、2.Starting action Action.Action.c(6): Detected non-resource http:/localhost/MercuryWebTours/header.html in http:/localhost/MercuryWebTours/ MsgId: MMSG-26574Action.c(6): Detected non-resource http:/localhost/MercuryWebTours/welcome.pl?signOff=true in http:/localhost/MercuryWebTours/ MsgId: MMSG-2657
29、4Action.c(6): Found resource http:/localhost/MercuryWebTours/images/banner_animated.gif in HTML http:/localhost/MercuryWebTours/header.html MsgId: MMSG-26659Action.c(6): Detected non-resource http:/localhost/MercuryWebTours/nav.pl?in=home in http:/localhost/MercuryWebTours/welcome.pl?signOff=true Ms
30、gId: MMSG-26574Action.c(6): Detected non-resource http:/localhost/MercuryWebTours/home.html in http:/localhost/MercuryWebTours/welcome.pl?signOff=true MsgId: MMSG-26574Action.c(6): Found resource http:/localhost/MercuryWebTours/images/banner_merctur.jpg in HTML http:/localhost/MercuryWebTours/home.html MsgId: MMSG-26659Action.c(6): Found resource http:/localhost/MercuryWebTours/images/sun_swede.gif in HTML http:/localhost/MercuryWebTours/nav.pl?in=home MsgId: MMSG-26659Action.c(6): Found resource http:/localhost/Mercury
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1