实训 LoadRunner测试脚本的参数化模板
- 格式:doc
- 大小:116.00 KB
- 文档页数:8
实验二 Loadrunner基本操作姓名:学号:一、实验目的(1)理解和掌握性能测试的基本原理和方法。
(2)掌握LR录制模式的选择与使用。
二、实验要求(1)运用LR录制登陆脚本,完成订票操作。
(2)回放脚本,观察结果。
(3)对脚本进行参数化。
三、实验内容(1)打开http://localhost/MercuryWebTours/订票页面,注册用户mike/mountain, jack/johnson,两个用户;(2)使用LR录制http://localhost/MercuryWebTours/订票页面的登录功能,对登录名和密码参数化,数据文件的数据如下:Username Passwordjojo beanjoe youngmike mountainjack johnson(3)将runtime settings中的run logic的循环次数设置为4;(4)将runtime settings中的log配置,选择extended log,且选中parameter substitution (5)回放脚本,在execution log中观察参数是否已经带入;(6)为登录就脚本设置一个事物,名称为”login transaction”(7)在实验报告中,记录每次的操作步骤及界面截图,保存execution log的执行日志。
四、实验结果:操作步骤及界面截图execution log的执行日志Virtual User Script startedStarting 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(7): Notify: Transaction login transaction started.Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/header.html" in "http://localhost/MercuryWebTours/" [MsgId: MMSG-26574]Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/welcome.pl?signOff=true" in "http://localhost/MercuryWebTours/" [MsgId: MMSG-26574]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/banner_animated.gif" in HTML "http://localhost/MercuryWebTours/header.html" [MsgId: MMSG-26659]Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?in=home" in "http://localhost/MercuryWebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574] Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/home.html" in "http://localhost/MercuryWebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574] Action.c(9): Found resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" in HTML "http://localhost/MercuryWebTours/home.html" [MsgId: MMSG-26659]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/sun_swede.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/login.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/signup.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/admin.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): web_url was successful, 51022 body bytes, 2171 header bytes [MsgId:MMSG-27176]Action.c(18): Submitting form to "http://localhost/MercuryWebTours/login.pl", Target Frame="body" [MsgId: MMSG-27978]Action.c(18): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" in "http://localhost/MercuryWebTours/login.pl" [MsgId: MMSG-26574]Action.c(18): Detected non-resource "http://localhost/MercuryWebTours/login.pl?intro=true" in "http://localhost/MercuryWebTours/login.pl" [MsgId: MMSG-26574]Action.c(18): 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(18): Found resource "http://localhost/MercuryWebTours/images/flights.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(18): Found resource "http://localhost/MercuryWebTours/images/itinerary.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659]Action.c(18): 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(18): Found resource "http://localhost/MercuryWebTours/images/signoff.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(18): Resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(18): web_submit_form was successful, 12483 body bytes, 1693 header bytes [MsgId: MMSG-27176]Action.c(27): Image-linking to "http://localhost/MercuryWebTours/welcome.pl?signOff=1", Target Frame="body" [MsgId: MMSG-27993]Action.c(27): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?in=home" in "http://localhost/MercuryWebTours/welcome.pl?signOff=1" [MsgId: MMSG-26574] Action.c(27): Detected non-resource "http://localhost/MercuryWebTours/home.html" in "http://localhost/MercuryWebTours/welcome.pl?signOff=1" [MsgId: MMSG-26574] Action.c(27): Resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): Resource "http://localhost/MercuryWebTours/images/sun_swede.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): Resource "http://localhost/MercuryWebTours/images/login.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): Resource "http://localhost/MercuryWebTours/images/signup.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): Resource "http://localhost/MercuryWebTours/images/admin.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): web_image was successful, 2366 body bytes, 698 header bytes [MsgId:MMSG-27176]Action.c(33): Notify: Transaction login transaction ended with Pass status (Duration: 1.3461). Ending action Action.Ending iteration 1.Starting iteration 2.Starting action Action.Action.c(7): Notify: Transaction login transaction started.Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/header.html" in "http://localhost/MercuryWebTours/" [MsgId: MMSG-26574]Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/welcome.pl?signOff=true" in "http://localhost/MercuryWebTours/" [MsgId: MMSG-26574]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/banner_animated.gif" in HTML "http://localhost/MercuryWebTours/header.html" [MsgId: MMSG-26659]Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?in=home" in "http://localhost/MercuryWebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574] Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/home.html" in "http://localhost/MercuryWebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574] Action.c(9): Found resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" in HTML "http://localhost/MercuryWebTours/home.html" [MsgId: MMSG-26659]"http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/login.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/signup.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/admin.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): web_url was successful, 51018 body bytes, 2171 header bytes [MsgId:MMSG-27176]Action.c(18): Submitting form to "http://localhost/MercuryWebTours/login.pl", Target Frame="body" [MsgId: MMSG-27978]Action.c(18): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" in "http://localhost/MercuryWebTours/login.pl" [MsgId: MMSG-26574]Action.c(18): Detected non-resource "http://localhost/MercuryWebTours/login.pl?intro=true" in "http://localhost/MercuryWebTours/login.pl" [MsgId: MMSG-26574]Action.c(18): 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(18): Found resource "http://localhost/MercuryWebTours/images/flights.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(18): Found resource "http://localhost/MercuryWebTours/images/itinerary.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(18): 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(18): Found resource "http://localhost/MercuryWebTours/images/signoff.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(18): Resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(18): web_submit_form was successful, 12482 body bytes, 1688 header bytes [MsgId: MMSG-27176]Action.c(27): Image-linking to "http://localhost/MercuryWebTours/welcome.pl?signOff=1", Target Frame="body" [MsgId: MMSG-27993]Action.c(27): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?in=home" in "http://localhost/MercuryWebTours/welcome.pl?signOff=1" [MsgId: MMSG-26574] Action.c(27): Detected non-resource "http://localhost/MercuryWebTours/home.html" in "http://localhost/MercuryWebTours/welcome.pl?signOff=1" [MsgId: MMSG-26574] Action.c(27): Resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): Resource "http://localhost/MercuryWebTours/images/sun_swede.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): Resource "http://localhost/MercuryWebTours/images/login.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): Resource "http://localhost/MercuryWebTours/images/admin.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): web_image was successful, 2367 body bytes, 698 header bytes [MsgId:MMSG-27176]Action.c(33): Notify: Transaction login transaction ended with Pass status (Duration: 1.3192). Ending action Action.Ending iteration 2.Starting iteration 3.Starting action Action.Action.c(7): Notify: Transaction login transaction started.Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/header.html" in "http://localhost/MercuryWebTours/" [MsgId: MMSG-26574]Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/welcome.pl?signOff=true" in "http://localhost/MercuryWebTours/" [MsgId: MMSG-26574]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/banner_animated.gif" in HTML "http://localhost/MercuryWebTours/header.html" [MsgId: MMSG-26659]Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?in=home" in "http://localhost/MercuryWebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574] Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/home.html" in "http://localhost/MercuryWebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574] Action.c(9): Found resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" in HTML "http://localhost/MercuryWebTours/home.html" [MsgId: MMSG-26659]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/sun_swede.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/login.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/signup.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/admin.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): web_url was successful, 51021 body bytes, 2171 header bytes [MsgId:MMSG-27176]Action.c(18): Submitting form to "http://localhost/MercuryWebTours/login.pl", Target Frame="body" [MsgId: MMSG-27978]Action.c(18): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" in "http://localhost/MercuryWebTours/login.pl" [MsgId: MMSG-26574]Action.c(18): Detected non-resource "http://localhost/MercuryWebTours/login.pl?intro=true" in "http://localhost/MercuryWebTours/login.pl" [MsgId: MMSG-26574]Action.c(18): Found resource "http://localhost/MercuryWebTours/images/sun_with_logo.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId:MMSG-26659]"http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(18): Found resource "http://localhost/MercuryWebTours/images/itinerary.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(18): 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(18): Found resource "http://localhost/MercuryWebTours/images/signoff.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(18): Resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(18): web_submit_form was successful, 12483 body bytes, 1635 header bytes [MsgId: MMSG-27176]Action.c(27): Image-linking to "http://localhost/MercuryWebTours/welcome.pl?signOff=1", Target Frame="body" [MsgId: MMSG-27993]Action.c(27): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?in=home" in "http://localhost/MercuryWebTours/welcome.pl?signOff=1" [MsgId: MMSG-26574] Action.c(27): Detected non-resource "http://localhost/MercuryWebTours/home.html" in "http://localhost/MercuryWebTours/welcome.pl?signOff=1" [MsgId: MMSG-26574] Action.c(27): Resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): Resource "http://localhost/MercuryWebTours/images/sun_swede.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): Resource "http://localhost/MercuryWebTours/images/login.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): Resource "http://localhost/MercuryWebTours/images/signup.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): Resource "http://localhost/MercuryWebTours/images/admin.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): web_image was successful, 2367 body bytes, 698 header bytes [MsgId:MMSG-27176]Action.c(33): Notify: Transaction login transaction ended with Pass status (Duration: 1.3043). Ending action Action.Ending iteration 3.Starting iteration 4.Starting action Action.Action.c(7): Notify: Transaction login transaction started.Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/header.html" in "http://localhost/MercuryWebTours/" [MsgId: MMSG-26574]Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/welcome.pl?signOff=true" in "http://localhost/MercuryWebTours/" [MsgId: MMSG-26574]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/banner_animated.gif" in HTML "http://localhost/MercuryWebTours/header.html" [MsgId: MMSG-26659]Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?in=home" in "http://localhost/MercuryWebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574]Action.c(9): Detected non-resource "http://localhost/MercuryWebTours/home.html" in "http://localhost/MercuryWebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574] Action.c(9): Found resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" in HTML "http://localhost/MercuryWebTours/home.html" [MsgId: MMSG-26659]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/sun_swede.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/login.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/signup.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): Found resource "http://localhost/MercuryWebTours/images/admin.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?in=home" [MsgId: MMSG-26659]Action.c(9): web_url was successful, 51013 body bytes, 2171 header bytes [MsgId:MMSG-27176]Action.c(18): Submitting form to "http://localhost/MercuryWebTours/login.pl", Target Frame="body" [MsgId: MMSG-27978]Action.c(18): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" in "http://localhost/MercuryWebTours/login.pl" [MsgId: MMSG-26574]Action.c(18): Detected non-resource "http://localhost/MercuryWebTours/login.pl?intro=true" in "http://localhost/MercuryWebTours/login.pl" [MsgId: MMSG-26574]Action.c(18): 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(18): Found resource "http://localhost/MercuryWebTours/images/flights.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(18): Found resource "http://localhost/MercuryWebTours/images/itinerary.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(18): 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(18): Found resource "http://localhost/MercuryWebTours/images/signoff.gif" in HTML "http://localhost/MercuryWebTours/nav.pl?page=menu&in=home" [MsgId: MMSG-26659] Action.c(18): Resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(18): web_submit_form was successful, 12483 body bytes, 1636 header bytes [MsgId: MMSG-27176]Action.c(27): Image-linking to "http://localhost/MercuryWebTours/welcome.pl?signOff=1", Target Frame="body" [MsgId: MMSG-27993]Action.c(27): Detected non-resource "http://localhost/MercuryWebTours/nav.pl?in=home" in "http://localhost/MercuryWebTours/welcome.pl?signOff=1" [MsgId: MMSG-26574] Action.c(27): Detected non-resource "http://localhost/MercuryWebTours/home.html" in "http://localhost/MercuryWebTours/welcome.pl?signOff=1" [MsgId: MMSG-26574] Action.c(27): Resource "http://localhost/MercuryWebTours/images/banner_merctur.jpg" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): Resource "http://localhost/MercuryWebTours/images/sun_swede.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): Resource "http://localhost/MercuryWebTours/images/login.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): Resource "http://localhost/MercuryWebTours/images/signup.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): Resource "http://localhost/MercuryWebTours/images/admin.gif" is in the cache already and will not be downloaded again [MsgId: MMSG-26655]Action.c(27): web_image was successful, 2359 body bytes, 698 header bytes [MsgId:MMSG-27176]Action.c(33): Notify: Transaction login transaction ended with Pass status (Duration: 1.4922). Ending action Action.Ending iteration 4.Ending Vuser...Starting action vuser_end.Ending action vuser_end.Vuser Terminated.。
软件测试实验报告loadrunner引言软件测试是保证软件质量的重要手段,而性能测试则是其中的一部分。
在实际应用中,软件的性能往往是用户持续使用的关键因素。
本实验通过使用LoadRunner工具对一个Web应用进行性能测试,旨在评估系统的可扩展性和稳定性。
实验目的1. 了解性能测试的概念和一般流程;2. 掌握LoadRunner工具的基本使用方法;3. 学会分析性能测试结果并调优。
实验环境- 操作系统:Windows 10- 浏览器:Google Chrome- LoadRunner版本:12.55实验步骤步骤一:录制脚本1. 打开LoadRunner主界面,在“组织测试”中选择“录制脚本”;2. 输入脚本名称,选择协议为“Web HTTP/HTML”,点击“开始录制”按钮;3. 在弹出的浏览器中输入被测应用的URL,进入应用的登录页面;4. 按照测试用例的要求进行操作,录制脚本过程中可以对测试步骤进行注释和标记;5. 完成录制后,点击“停止录制”按钮。
步骤二:设计场景1. 在LoadRunner主界面,选择“组织测试”中的“设计场景”;2. 在“设计场景”界面中,将录制的脚本添加到“事务”中,可以设置事务的名称和模式;3. 将事务进行参数化,设置不同的参数取值,以模拟用户的不同行为;4. 可以设置事务之间的延迟时间,模拟用户的思考和操作过程。
步骤三:运行测试1. 在LoadRunner主界面,选择“执行测试”;2. 在“执行测试”界面中,选择要执行的场景,设置并发用户数、循环次数等参数;3. 启动测试并观察测试过程中的各项指标的变化情况,包括响应时间、吞吐量、错误率等;4. 完成测试后,查看测试报告,分析测试结果。
步骤四:优化调整1. 根据测试报告,可以发现系统的瓶颈和性能问题所在;2. 可以对系统进行优化调整,比如增加硬件资源、调整系统配置、修改代码逻辑等;3. 重新运行测试,对比测试结果,看优化效果。
压力测试报告拟制Prepared By 日期Date审核Reviewed By 日期Date目录第1章系统概述 (4)第2章方案设计 (4)第3章方案一测试结果........................................................................ 错误!未定义书签。
3.1 方案摘要.................................................................................... 错误!未定义书签。
3.2 运行结果.................................................................................... 错误!未定义书签。
第4章方案二测试结果........................................................................ 错误!未定义书签。
4.1 方案摘要.................................................................................... 错误!未定义书签。
4.2 运行结果.................................................................................... 错误!未定义书签。
第5章结论............................................................................................ 错误!未定义书签。
第6章附录............................................................................................ 错误!未定义书签。
Loadrunner中参数的设置(五篇模版)第一篇:Loadrunner中参数的设置Loadrunner中参数的设置在做负载或者压力测试时,很多人选择使用了Loadrunner测试工具。
该工具的基本流程是先将用户的实际操作录制成脚本,然后产生数千个虚拟用户运行脚本(虚拟用户可以分布在局域网中不同的PC 机上),最后生成相关的报告以及分析图。
但是在录制脚本的过程中会遇到很多实际的问题,比如不同的用户有不同的使用数据,这就牵涉到参数的设置问题。
本文就Loadrunner中参数的设置进行说明,希望对大家有所帮助。
录制程序运行的过程中,VuGen(脚本生成器)自动生成了包含录制过程中实际用到的数值的脚本。
如果你企图在录制的脚本中使用不同的数值执行脚本的活动(如查询、提交等等),那么你必须用参数值取代录制的数值。
这个过程称为参数化脚本。
本文主要包括如下内容:理解参数的局限性、建立参数、定义参数的属性、理解参数的类型、为局部数据类型设置参数的属性、为数据文件设置参数的属性、从已经存在的数据库中引入数据。
除了GUI,以下的内容适合于各种类型的用户脚本。
一、关于参数的定义在你录制程序运行的过程中,脚本生成器自动生成由函数组成的用户脚本。
函数中参数的值就是在录制过程中输入的实际值。
例如,你录制了一个Web应用程序的脚本。
脚本生成器生成了一个声明,该声明搜索名称为“UNIX”的图书的数据库。
当你用多个虚拟用户和迭代回放脚本时,也许你不想重复使用相同的值“UNIX”。
那么,你就可以用参数来取代这个常量。
结果就是你可以用指定的数据源的数值来取代参数值。
数据源可以是一个文件,也可以是内部产生的变量。
用参数表示用户的脚本有两个优点:① 可以使脚本的长度变短。
② 可以使用不同的数值来测试你的脚本。
例如,如果你企图搜索不同名称的图书,你仅仅需要写提交函数一次。
在回放的过程中,你可以使用不同的参数值,而不只搜索一个特定名称的值。
LoadRunner参数化设置LoadRunner脚本处理时,为了满⾜业务需要、适应环境变化(例如使⽤不同的⽤户名、密码登录系统),经常使⽤参数化技巧。
简单介绍如下:⼀、创建参数选中要参数化的内容。
⽅法⼀,右键---【Replace with a new parameter】⽅法⼆,菜单【insert】----【new Parameter…】⼆、设置数据来源添加参数后,选择Properties。
如果参数类型为普通参数,数据来源⼀般有以下3种:⽂件、表格、数据库1、第⼀种⽂件:点击Browser,选择已保存好的数据⽂件2、第⼆种表格:点击Create Table,通过上⽅add column/delete column按键编辑或者Edit with Notepad在记事本中编辑。
3、第三种数据库:点击Data Wizard,打开数据库连接向导,创建数据库连接,编写SQL语句三、参数关联有些参数有关联关系,如何确保脚本使⽤正确关联的参数值呢?操作如下:以⽤户名、密码为例,⽤户名的参数化设置完成后,会保存成dat⽂件,在File列表中选择⽤户名的dat⽂件。
点击Add column添加新列,在当前页⾯编辑或者Edit with Notepad在记事本中编辑密码的数据来源。
四、参数分配与更新⽅式1、Select next row,有三个选项:顺序(Sequential):按照参数化的数据顺序,⼀个⼀个的来取。
随机(Random):参数化中的数据,每次随机的从中抽取数据。
唯⼀(Unique):为每个虚拟⽤户分配⼀条唯⼀的数据2、Update value on,有三个选项:每次迭代(Each iteration) :每次迭代时取新的值,假如50个⽤户都取第⼀条数据,称为⼀次迭代;完了50个⽤户都取第⼆条数据,后⾯以此类推。
每次出现(Each occurrence):每次参数时取新的值,这⾥强调前后两次取值不能相同。
实训LoadRunner测试脚本的参数化1.1实训目标能够使用参数化数据解决系统压力问题能够使用数据池中数据对参数变量实施参数化能够使用数据库中数据对参数变量实施参数化具备使用不同数据对系统施加预期压力的能力1.2问题引出:观察以下示例代码web_url("MercuryWebTours","URL=http://localhost/MercuryWebTours/","Resource=0","RecContentType=text/html","Referer=","Snapshot=t2.inf","Mode=HTML",LAST);lr_think_time(5);web_submit_form("login.pl","Snapshot=t3.inf",ITEMDATA,"Name=username", "Value=jojo", ENDITEM,"Name=password", "Value=bean", ENDITEM,"Name=login.x", "Value=53", ENDITEM,"Name=login.y", "Value=18", ENDITEM,LAST);代码分析:在这段代码中,用灰色背景黑色字体标识的是用户输入的用户名和口令,如果直接使用这段脚本对应用进行测试,则所有VU都会使用同一个用户名和口令登录系统。
如果要模拟更加真实的应用场景(例如,不同权限的用户执行同一个操作),就有必要将用户名和口令用变量代替,为变量的取值准备一个“数据池”并设定变量的取值规则,这样每个VU在执行的时候就能根据要求取不同的值。
实用文档一、实验目的熟悉LoadRunner的使用并对网站进行并发测试得到性能指标。
二、实验内容1、题目内容描述题目一:LoadRunner的使用熟悉LoadRunner的界面,掌握LoadRunner进行性能测试的测试流程。
题目二:对某个网站进行并发测试录制用户登录系统过程,并进行参数化。
然后分别模拟10个、20个、50个和100个用户登录系统,分别获得响应时间、吞吐量等性能指标。
2、测试计划测试流程:第一步:制定测试计划第二步:创建虚拟用户脚本第三步:创建场景第四步:运行测试第五步:监视场景第六步:分析测试结果1.系统分析本网站的用户有三类,一类是教师,可以对学生该科目的成绩等进行操作;一类是学生,进入该网站并登录教务系统,另一类是管理员。
2.系统压力强度估算3.系统性能测试项本次测试的主要内容是用户并发测试。
主要指对系统的核心部分进行测试,以真实的业务数据作为输入,选择有代表性和关键的业务操作来设计测试用例。
根据测试计划,对下列业务进行并发测试:(1)点击进入计科学院(2)主页搜索(3)登陆教务系统(4)组合业务注:由于条件的限制,在进行性能测试中不可能对所有的功能点都进行性能测试,在此只选择了几个典型的功能点。
3、实验过程使用LoadRunner对西南科技大学的网站进行测试。
1、对登陆的用户名和密码进行参数化设置迭代次数为1,设置虚拟用户分别为5和10,localhost进行连接,点击运行。
2.设置本地连接、等待时间等。
3.运行。
4、测试结果点击模块测试用例搜索模块测试用例教务处登陆用例三、实验思考通过这次实验学习了使用LoadRunner对网站进行性能测试,压力测试,获得响应时间、吞吐量、点击率等性能指标。
使用这个工具对我们测试网站的性能有很大的帮助,经过参数化后模拟登陆用户进行大量并发测试,获得性能指标,避免网站承受能力差的情况,提高质量。
这样使用工具来测试网站比手动测试方便多了,而且不会出错。
目录1 概述 (2)1.1 目的 (2)1.2 背景 (2)1.3 范围 (2)2 测试概要 (2)2.1 测试环境 (2)2.2 人力资源 (2)2.3 测试工作量 (3)3 测试内容及方法 (3)3.1 测试需求/目标 (3)3.2 测试内容 (3)3.3 测试工具 (3)4 测试结果及分析 (3)4.1 网站处理性能评估 (3)4.2并发登录用户测试 (4)5 结果分析 (5)5.1 场景执行情况 (5)5.2 Statistics Summary(统计信息摘要) (5)5.3 Transaction Summary(事务摘要) (6)5.4 HTTP Responses Summary(HTTP响应摘要) (6)5.5 并发数分析 (7)5.6 响应时间 (8)5.7 每秒点击数 (8)1 概述1.1 目的本测试报告为IJob的首页面搜索访问的性能测试报告,目的在于总结测试阶段的测试以及分析测试结果,描述网站是否符合需求。
1.2 背景考虑到用户数量及数据的增多给服务器造成压力不可估计,因此计划对网站负载性能测试,在系统配置不变的情况下,在一定时间内,服务器在高负载情况下的性能行为表现,便于对系统环境进行正确的分析及评估。
1.3 范围本次测试主要是IJob首页面访问的性能测试。
2 测试概要2.1 测试环境PC机:Lenovo笔记本操作系统:windows XP测试机与被测服务器在同一局域网进行,排除了网速限制及网速度不稳定性。
2.2 人力资源下表列出了所有参与此项目的测试人员:2.3 测试工作量3 测试内容及方法3.1 测试需求/目标在大用户量、数据量的超负荷下,获得服务器运行时的相关数据,从而进行分析系统的稳定性。
3.2 测试内容本次测试主要是对IJob首页访问操作在大负荷情况下处理数据的能力及承受能力。
测试方法:3.3 测试工具主要测试工具为:LoadRunner性能测试工具辅助软件:截图工具,Word20034 测试结果及分析4.1 网站处理性能评估这次测试属于局域网环境进行,排除了外网的网速限制及不稳定性。
LoadRunner性能测试实验指导书一、实验目的1.掌握LoadRunner 8。
1操作界面的组成。
2.着重掌握如何在不同的环境中使用LoadRunner来作为自动化的功能测试工具.3.LoadRunner的性能测试流程4.LoadRunner的主界面5.LoadRunner的脚本录制6.LoadRunner的场景设计7.LoadRunner的场景监视8.LoadRunner的结果分析二、基本知识1.具有微软Windows的使用经验2.熟悉网络和浏览器知识3.熟悉测试概念4.LoadRunner8.1的使用概要。
三、实验设备及环境①windows操作系统、LoadRunner8.1应用软件②参考资料:电子稿件Mercury LoadRunner 教程四、实验内容第一部分:LoadRunner入门1. 环境配置(1)安装Mercury Tours程序和 Xitami 服务器选择“开始> 所有程序> Mercury LoadRunner > Samples Setup”安装,进行到Installation components and sub-components时选择“WEB”,安装完成后选择“开始> 所有程序〉Mercury LoadRunner > Samples > Web”查看。
(2)配置 XitamiXitami 安装后默认端口为 80,与IIS的端口冲突,所以需要修改配置文件xitami.cfg,将portbase=0 改为portbase=1000,修改完成后重新启动 Xitami 服务器.(3)启动 Xitami选择“开始〉所有程序〉Mercury LoadRunner 〉Samples > Web > Start Web Server”启动XitamiMercury Tours程序 URL 地址为:http://localhost:1080/WebTours/2。
200个不同用户登陆结果分析1、L oadrunner测试结果分析如下:Summary(场景摘要)结果及分析如下:Secenario name 场景名称Results in session 场景运行的结果目录Duration 场景运行时间Maximum running vusers(场景最大用户数)Total throughput (bytes)(总带宽流量)Average throughput (bytes/second)(平均每秒宽带流量)Total hit(总点击数)Average hits per second(平均每秒点击数)图1-1此次测试我用了200个用户, 163个passed, 所以实际参与测试的虚拟用户总共有163个。
其中, 总的吞吐量为535484969bytes, 平均吞吐量为1459087bytes, 总的请求量为12321, 平均每秒请求量为33.572, 错误共有37个。
从该图可以看出, 该网页在用户登陆方面存在问题。
图1-2图1-3(注: Action.c(92): Error -27796: Failed to connect to server "61.177.55.188:8080": [10060] Connection timed out.Action.c(104).Erro.-27727.Ste.downloa.timeou.(12.seconds.ha.expire.whe.downloadin.reso urce(s).Se.th."Ste.Timeou.cause.b.resource.i..warning.Run-Tim.Settin.t.Yes/N.t.hav.thi.mes sag.a..warning/error.respectively.Error: missing newline in D:\Program Files\HP\LoadRunner\tutorial\账户登陆1\Name.dat)Running Vusers结果及分析如下:图2-1通过上面图形结果可知, 在刚开始虚拟用户为100个, 11s左右时达到200个, 从1min45s 后逐渐减少, 6min7s左右时用户全部退出访问。
实训LoadRunner测试脚本的参数化
1.1实训目标
能够使用参数化数据解决系统压力问题
能够使用数据池中数据对参数变量实施参数化
能够使用数据库中数据对参数变量实施参数化
具备使用不同数据对系统施加预期压力的能力
1.2问题引出:
观察以下示例代码
web_url("MercuryWebTours",
"URL=http://localhost/MercuryWebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t2.inf",
"Mode=HTML",
LAST);
lr_think_time(5);
web_submit_form("login.pl",
"Snapshot=t3.inf",
ITEMDATA,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=login.x", "Value=53", ENDITEM,
"Name=login.y", "Value=18", ENDITEM,
LAST);
代码分析:
在这段代码中,用灰色背景黑色字体标识的是用户输入的用户名和口令,如果直接使用这段脚本对应用进行测试,则所有VU都会使用同一个用户名和口令登录系统。
如果要模拟更加真实的应用场景(例如,不同权限的用户执行同一个操作),就有必要将用户名和口令用变量代替,为变量的取值准备一个“数据池”并设定变量的取值规则,这样每个VU在执行的时候就能根据要求取不同的值。
当然,要进行参数化的场合远远不止用户名和口令的处理。
设想这样一种情况,需要模拟多个用户同时操作一个页面,该页面要求用户输入一条信息记录,且规定记录内容不能重复。
对于这种情况,如果不采用参数化的方式,则必须为每个可能的VU使用一个不同的脚本。
采用参数化方式时,只需要将输入的内容设置为参数,在参数池中给出大于VU 的数据即可。
1.3任务描述
“参数化”是LoadRunner的脚本处理过程中最常用的操作技巧之一。
LoadRunner在录制脚本的时候,只是忠实的记录了所有从客户端发送到服务器的数据,而要进行性能测试,在环境变化(例如,需要使用不同的用户名和口令)时就必须让脚本适应环境变化的能力。
可以通过将要更改的内容设为“参数”,然后允许参数以某种方式和形式取值,在脚本运行时就可以通过预先设定的规则,在脚本运行时取不同的值。
要求:完成客户信息的注册任务
(1)对以上数据分别实行参数化,通过回放脚本实现不同用户的注册功能。
(2)添加注册事务
(3)加入集合点
(4)加入验证用户成功注册的检查点
(5)更改运行时日志选项将参数化数据的替换过程在执行日志中显示
1.4覆盖的知识点
录制脚本、参数化、事务、集合点
1.5实训参考步骤
LoadRunner提供了对参数化很好的支持,最简单的方法是通过上下文菜单直接对脚本中的某部分内容进行参数化操作,具体操作方法如下:
(1)在脚本中选择需要参数化的内容,单击右键,从弹出菜单选择Replace with a parameter 命令,如图
(2)在弹出的对话框中给出参数的名称、类型,图中给出的参数名为username,参数的类型为File。
File类型可以利用数据文件为参数提供数据池,并设置参数依据某种规则从数据池中取出替代脚本中的参数。
注意:将某个参数类型设置为File或Table后,可以手工编辑数据文件形成参数的数据池,这里特别需要注意的是数据文件一定要以一个空行结束,否则最后一行输入的数据不会被参
数所使用。
(3)单击该对话框的Properties按钮可以设定参数数据池的内容以及参数的取值方式。
在该对话框中增加参数和设定参数的属性。
指定参数的Update方式
所谓参数的Update方式指名参数在何种情况下发生改变,以何种规则改变。
下图是File类型参数Update方式设置的对话框内容,从图中可以看到,参数的Update方式
包含Select next row、Update value on 和when out of values 3个选项。
Update value on 指明了参数在何时发生改变。
该选择共有3个选项:Each Iteration、Each Occurrence和Once。
Each Iteration表示“在每次迭代时更新参数的值”、Each Occurrence表示“在参数每次出现时更新参数的值”。
对Each Iteration而言,一个VU执行时,每次迭代时更新参数的值,如果在一个迭代过程中参数出现了多次,参数取相同值。
而对Each Occurrence而言,如果一个迭代过程中某参数出现了多次,每次都取不同值。
Once表示VU 执行过程中,只在第一次迭代时为参数取一次值,以后每次迭代取相同值。
Select next row指明以何种方式从数据池中获取数据,该选择共有三个选项,Sequential
(顺序取值),Random(随机取值),Unique(每次取唯一值)。
根据Select next row和Update value on 的不同设置组合,VU运行过程中为参数取不同的值。
举例说明:
例:假设为某个类型为File的参数Username设置表B1所示的数据池,该参数所在的脚本中包含该参数的部分要求迭代2次,执行脚本的VU数量为2个,脚本需要迭代的部分有两个地方使用了参数Username。
则在不同设置时参数取值见表B2描述。
从上表描述可以看出,只有当参数的Select next row 设置为Unique时,才能保证每个vu在每次迭代时取不同的值。
1.6 课后任务
录制一个Tomcat自带的一个小程序numguess,该小程序实现的是一个非常简易的猜数
字游戏,系统随机生成一个1-100之间的数字,作为标准数值,用户在文本框中输入猜测的数字,如果输入的数值比标准数值大,则告知您应该输入小一点的数字;否则相反;如果输入的正好是标准数值,那么就会出现恭喜成功的页面。
知识点:录制脚本、参数化、事务、集合点
参考步骤:
(1)录制脚本URL=http://localhost:8080/jsp-examples/num/numguess.jsp,启动页面,在文本框中输入数字“2”,单击[submit]按钮,完成一个猜数字过程。
停止录制。
(2)录制完成后,需要对脚本进行完善,想考查该小程序的并发处理能力及了解事务的处理时间的情况,所以需要加入集合点和事务。
改良后的脚本代码如下:
Action()
{
lr_rendezvous("集合点");
lr_start_transaction("执行时间");
web_url("numguess.jsp",
"URL=http://localhost:8080/jsp-examples/num/numguess.jsp",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
lr_think_time(5);
web_submit_form("numguess.jsp_2",
"Snapshot=t2.inf",
ITEMDATA,
"Name=guess", "Value=2", ENDITEM,
LAST);
lr_end_transaction("执行时间", LR_AUTO);
return 0;
}
(3)通常,如果猜数字不正确之后,我们都会根据提示,尝试输入另外一个数字,猜这个数字是否就是那个正确的数字。
这就涉及脚本参数化的问题,在这里需要对脚本中的Value=2进行参数化,将其参数化为“guessval”,相应的数据文件为“guessval.dat”,包括数据为“35-44,28-37”。
如果在Controller里进行负载测试的时候,希望10个用户并发,每个虚拟用户取2个数值。
这样必须设置脚本参数的取值策略,数据分配方法选择“Unique”,数据更新方式选择“Each iteration”,同时指定在Controller中执行时“Allocate 2 values for each Vusers”,这样在Controller中进行负载测试时就符合先前设计思想,10个用户进行负载测试,每个用户迭代两次,每次取一个数值。