软件测试案例分析 实验三、LoadRunner检查点(DOC)
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
南昌航空大学实验报告
2013/06/06
课程名称:软件测试案例分析实验名称: LoadRunner检查点班级:姓名:同组人:
指导教师评定:签名:
一、实验目的
(1)理解和掌握性能测试的基本原理和方法。
(2)掌握LR检查点的使用与脚本设计。
二、实验要求
(1)运用LR录制订票操作的脚本。
(2)回放脚本,观察结果。
(3)对订票的金额设置检查点。
三、实验内容
(一)、使用LR录制mercury tours订票系统订票操作的脚本。
具体步骤如下:
(1)打开LR的录制配置窗口,将登陆页面的脚本录制到vuser_init动作中(确认将Winxp系统的防火墙关闭)。
如下图所示:
或者joe/young登陆订票系统,如下图所示;
(3)重新选择recording窗口的动作下拉列表,将以下的操作录制到action动作中;
(4)继续录制操作,点击flights按钮,进入订票窗口,选择Departure City为Frankfurt,
Arrival City为London,No of Passengers为1,其他为默认设置,如下图所示:
如下图所示:
(6)点击continue按钮,继续录制,进入信用卡支付页面,如下图所示:
按钮。
进入机票确认窗口。
如下图所示:
(8)订票结束,点击sign off按钮返回登录页面。
(二)、下面通过设置检查点函数来检查页面中的相关信息,步骤如下:
(1)使用web_find()函数,来检查登录成功以后的欢迎页面是否是以“Welcome”开始
的。
如下图所示:
函数作用:在页面中查找相应的内容
参数举例:web_find("web_find","RighOf=a","LeftOf=b","What=name",LAST);
参数解释:"web_find"定义该查找函数的名称;“LeftOf”和“RighOf=”用来定义查找字符的左右边界;“What=”定义查找内容。
例如上述参数举例中的意思就是在页面中查找左边界为b,右边界为a,内容为name 的信息
函数用法:该函数是在查找页面中的内容,所以要放在要查找的内容的后面。
注意事项:使用该函数时,要在Vuser->Run-Tme Settings中更改下设置
勾选Enable Image and text check
系统默认是不勾选该选项的。
关于该函数的其他说明:该函数只能在基于HTML模式录制的脚本中进行查找。
(2)由于欢迎页面“Welcome”的右侧是逗号“,”,所以在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)由于web_find是在页面中查找文本是否出现,最好在web_submit_form的脚本后
插入thinktime,保证等待页面打开后再来查找检查点的文本,因此修改脚本如下所示:
(7)脚本确认以后,回放脚本,查看execution Log,能发现如下的日志“web_find successful. 1 occurrence(s) of “Welcome” found”,表示检查点执行正确:
(三)若检查订单确认页面的“Total cost”是否为266,请录制脚本设置检查点。
(四)在订票系统登录后,将显示欢迎的页面,具体页面如下:
在该页面中,如果以joe登陆,则在页面中将显示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 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的设置窗口,如下图所示:
(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/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}", 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 started
Starting action vuser_init.
Web Turbo Replay of LoadRunner 7.80.0 for WINXP; Web build 2271 [MsgId:
MMSG-27143]
Run-Time Settings file: "C:\Documents and Settings\Administrator\Local Settings\Temp\noname1\\default.cfg" [MsgId: MMSG-27141]
Ending action vuser_init.
Running Vuser...
Starting iteration 1.
Starting action Action.
Action.c(6): Detected non-resource "http://localhost/MercuryWebTours/header.html" in "http://localhost/MercuryWebTours/" [MsgId: MMSG-26574]
Action.c(6): Detected non-resource "http://localhost/MercuryWebTours/welcome.pl?signOff=true" in "http://localhost/MercuryWebTours/" [MsgId: MMSG-26574]
Action.c(6): Found resource "http://localhost/MercuryWebTours/images/banner_animated.gif" in HTML "http://localhost/MercuryWebTours/header.html" [MsgId: MMSG-26659] Action.c(6): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?in=home" in "http://localhost/MercuryWebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574]
Action.c(6): Detected non-resource "http://localhost/MercuryWebTours/home.html" in "http://localhost/MercuryWebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574] Action.c(6): Found resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" in HTML "http://localhost/MercuryWebTours/home.html" [MsgId: MMSG-26659]
Action.c(6): Found resource "http://localhost/MercuryWebTours/images/sun_swede.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659] Action.c(6): Found resource "http://localhost/MercuryWebTours/images/login.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]
Action.c(6): Found resource "http://localhost/MercuryWebTours/images/signup.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]
Action.c(6): Found resource "http://localhost/MercuryWebTours/images/admin.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]
Action.c(6): web_url was successful, 51016 body bytes, 2125 header bytes [MsgId:
MMSG-27176]
Action.c(15): Submitting form to "http://localhost/MercuryWebTours/login.pl", Target Frame="body" [MsgId: MMSG-27978]
Action.c(15): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" in "http://localhost/MercuryWebTours/login.pl" [MsgId: MMSG-26574]
Action.c(15): Detected non-resource "http://localhost/MercuryWebTours/login.pl?intro=true" in "http://localhost/MercuryWebTours/login.pl" [MsgId: MMSG-26574]
Action.c(15): Found resource "http://localhost/MercuryWebTours/images/sun_with_logo.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId:
MMSG-26659]
Action.c(15): Found resource "http://localhost/MercuryWebTours/images/flights.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(15): Found resource "http://localhost/MercuryWebTours/images/itinerary.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId:
MMSG-26659]
Action.c(15): Found resource "http://localhost/MercuryWebTours/images/in_home.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId:
MMSG-26659]
Action.c(15): Found resource "http://localhost/MercuryWebTours/images/signoff.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(15): Resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(15): web_submit_form was successful, 12483 body bytes, 1693 header bytes [MsgId: MMSG-27176]
Action.c(23): "web_find" successful. 1 occurrence(s) of "jojo" found (RightOf="", LeftOf=",") [MsgId: MMSG-27196]
Action.c(23): web_find was successful [MsgId: MMSG-27182]
Action.c(28): Image-linking to "http://localhost/MercuryWebTours/welcome.pl?signOff=1", Target Frame="body" [MsgId: MMSG-27993]
Action.c(28): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?in=home" in
"http://localhost/MercuryWebTours/welcome.pl?signOff=1" [MsgId: MMSG-26574] Action.c(28): Detected non-resource "http://localhost/MercuryWebTours/home.html" in "http://localhost/MercuryWebTours/welcome.pl?signOff=1" [MsgId: MMSG-26574] Action.c(28): Resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(28): Resource "http://localhost/MercuryWebTours/images/sun_swede.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(28): Resource "http://localhost/MercuryWebTours/images/login.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(28): Resource "http://localhost/MercuryWebTours/images/signup.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(28): Resource "http://localhost/MercuryWebTours/images/admin.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(28): web_image was successful, 2368 body bytes, 652 header bytes [MsgId: MMSG-27176]
Ending action Action.
Ending iteration 1.
Starting iteration 2.
Starting action Action.
Action.c(6): Detected non-resource "http://localhost/MercuryWebTours/header.html" in "http://localhost/MercuryWebTours/" [MsgId: MMSG-26574]
Action.c(6): Detected non-resource "http://localhost/MercuryWebTours/welcome.pl?signOff=true" in "http://localhost/MercuryWebTours/" [MsgId: MMSG-26574]
Action.c(6): Found resource "http://localhost/MercuryWebTours/images/banner_animated.gif" in HTML "http://localhost/MercuryWebTours/header.html" [MsgId: MMSG-26659] Action.c(6): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?in=home" in "http://localhost/MercuryWebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574] Action.c(6): Detected non-resource "http://localhost/MercuryWebTours/home.html" in "http://localhost/MercuryWebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574] Action.c(6): Found resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" in HTML "http://localhost/MercuryWebTours/home.html" [MsgId: MMSG-26659]
Action.c(6): Found resource "http://localhost/MercuryWebTours/images/sun_swede.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659] Action.c(6): Found resource "http://localhost/MercuryWebTours/images/login.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]
Action.c(6): Found resource "http://localhost/MercuryWebTours/images/signup.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]
Action.c(6): Found resource "http://localhost/MercuryWebTours/images/admin.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]
Action.c(6): web_url was successful, 51022 body bytes, 2125 header bytes [MsgId:
MMSG-27176]
Action.c(15): Submitting form to "http://localhost/MercuryWebTours/login.pl", Target Frame="body" [MsgId: MMSG-27978]
Action.c(15): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" in "http://localhost/MercuryWebTours/login.pl" [MsgId: MMSG-26574]
Action.c(15): Detected non-resource "http://localhost/MercuryWebTours/login.pl?intro=true" in "http://localhost/MercuryWebTours/login.pl" [MsgId: MMSG-26574]
Action.c(15): Found resource "http://localhost/MercuryWebTours/images/sun_with_logo.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId:
MMSG-26659]
Action.c(15): Found resource "http://localhost/MercuryWebTours/images/flights.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(15): Found resource "http://localhost/MercuryWebTours/images/itinerary.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId:
MMSG-26659]
Action.c(15): Found resource "http://localhost/MercuryWebTours/images/in_home.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId:
MMSG-26659]
Action.c(15): Found resource "http://localhost/MercuryWebTours/images/signoff.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(15): Resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(15): web_submit_form was successful, 12482 body bytes, 1688 header bytes [MsgId: MMSG-27176]
Action.c(23): "web_find" successful. 1 occurrence(s) of "joe" found (RightOf="", LeftOf=",") [MsgId: MMSG-27196]
Action.c(23): web_find was successful [MsgId: MMSG-27182]
Action.c(28): Image-linking to "http://localhost/MercuryWebTours/welcome.pl?signOff=1", Target Frame="body" [MsgId: MMSG-27993]
Action.c(28): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?in=home" in "http://localhost/MercuryWebTours/welcome.pl?signOff=1" [MsgId: MMSG-26574] Action.c(28): Detected non-resource "http://localhost/MercuryWebTours/home.html" in "http://localhost/MercuryWebTours/welcome.pl?signOff=1" [MsgId: MMSG-26574] Action.c(28): Resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(28): Resource "http://localhost/MercuryWebTours/images/sun_swede.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(28): Resource "http://localhost/MercuryWebTours/images/login.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(28): Resource "http://localhost/MercuryWebTours/images/signup.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(28): Resource "http://localhost/MercuryWebTours/images/admin.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(28): web_image was successful, 2366 body bytes, 652 header bytes [MsgId: MMSG-27176]
Ending action Action.
Ending iteration 2.
Starting iteration 3.
Starting action Action.
Action.c(6): Detected non-resource "http://localhost/MercuryWebTours/header.html" in "http://localhost/MercuryWebTours/" [MsgId: MMSG-26574]
Action.c(6): Detected non-resource "http://localhost/MercuryWebTours/welcome.pl?signOff=true" in "http://localhost/MercuryWebTours/" [MsgId: MMSG-26574]
Action.c(6): Found resource "http://localhost/MercuryWebTours/images/banner_animated.gif" in HTML "http://localhost/MercuryWebTours/header.html" [MsgId: MMSG-26659] Action.c(6): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?in=home" in "http://localhost/MercuryWebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574] Action.c(6): Detected non-resource "http://localhost/MercuryWebTours/home.html" in "http://localhost/MercuryWebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574] Action.c(6): Found resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" in HTML "http://localhost/MercuryWebTours/home.html" [MsgId: MMSG-26659]
Action.c(6): Found resource "http://localhost/MercuryWebTours/images/sun_swede.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659] Action.c(6): Found resource "http://localhost/MercuryWebTours/images/login.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]
Action.c(6): Found resource "http://localhost/MercuryWebTours/images/signup.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]
Action.c(6): Found resource "http://localhost/MercuryWebTours/images/admin.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]
Action.c(6): web_url was successful, 51018 body bytes, 2125 header bytes [MsgId:
MMSG-27176]
Action.c(15): Submitting form to "http://localhost/MercuryWebTours/login.pl", Target Frame="body" [MsgId: MMSG-27978]
Action.c(15): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" in "http://localhost/MercuryWebTours/login.pl" [MsgId: MMSG-26574]
Action.c(15): Detected non-resource "http://localhost/MercuryWebTours/login.pl?intro=true" in "http://localhost/MercuryWebTours/login.pl" [MsgId: MMSG-26574]
Action.c(15): Found resource "http://localhost/MercuryWebTours/images/sun_with_logo.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId:
MMSG-26659]
Action.c(15): Found resource "http://localhost/MercuryWebTours/images/flights.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(15): Found resource "http://localhost/MercuryWebTours/images/itinerary.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId:
MMSG-26659]
Action.c(15): Found resource "http://localhost/MercuryWebTours/images/in_home.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId:
MMSG-26659]
Action.c(15): Found resource "http://localhost/MercuryWebTours/images/signoff.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(15): Resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(15): web_submit_form was successful, 12482 body bytes, 1635 header bytes [MsgId: MMSG-27176]
Action.c(23): "web_find" successful. 1 occurrence(s) of "tom" found (RightOf="", LeftOf=",") [MsgId: MMSG-27196]
Action.c(23): web_find was successful [MsgId: MMSG-27182]
Action.c(28): Image-linking to "http://localhost/MercuryWebTours/welcome.pl?signOff=1", Target Frame="body" [MsgId: MMSG-27993]
Action.c(28): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?in=home" in "http://localhost/MercuryWebTours/welcome.pl?signOff=1" [MsgId: MMSG-26574] Action.c(28): Detected non-resource "http://localhost/MercuryWebTours/home.html" in "http://localhost/MercuryWebTours/welcome.pl?signOff=1" [MsgId: MMSG-26574] Action.c(28): Resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(28): Resource "http://localhost/MercuryWebTours/images/sun_swede.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(28): Resource "http://localhost/MercuryWebTours/images/login.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(28): Resource "http://localhost/MercuryWebTours/images/signup.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(28): Resource "http://localhost/MercuryWebTours/images/admin.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]
Action.c(28): web_image was successful, 2367 body bytes, 652 header bytes [MsgId: MMSG-27176]
Ending action Action.
Ending iteration 3.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.
报告:。