下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、,LoadRunner Quick Tutorial,LR78-SLIDES-01A,大纲,Load runner介绍 规划 编写脚本 脚本录制、调试、优化 场景设计 用户数、场景类型、场景计划、运行设置、实时监控 场景执行 调试场景、小压力运行、100%负载测试、压力测试 结果分析 常用指标观察、生成测试报告,第一节,LoadRunner 介绍,为什么要进行压力测试,The failure of a mission-critical application can be costly Assure performance and functionality under real-world
2、conditions Locate potential problems before your customers do Reduce development time Reduce infrastructure costs,压力测试分类,Find out whether the system can handle the expected load upon deployment under real-world conditions.,Find the applications breaking point. Apply testing that measures whether the
3、 applications environment is properly configured to handle expected or potentially unexpected high transaction volumes.,Find the stability of the system with respect to handling large amounts of data over extended time periods.,Find the behavior and performance of each tier.,压力测试目标举例,Application res
4、ponse time How long does it take to complete a task? Configuration sizing Which configuration provides the best performance level? Acceptance Is the system stable enough to go into production? Regression Does the new version of the software adversely affect response time?,Reliability How stable is t
5、he system under a heavy work load? Capacity planning At what point does degradation in performance occur? Bottleneck identification What is the cause of degradation in performance? Product evaluation What is the best server for 100 users?,Testers,Load Generation,System Under Test,Do you have the tes
6、ting resources? Testing personnel Client machines,How do you synchronize users?,How do you collect and analyze results?,How do you achieve test repeatability?,Everybody, click the SEARCH button again,手工测试的问题,Database server,Application server,LoadRunner解决方案,Overcomes resource limitations,Provides me
7、aningful results with analysis tools,Allows repeatable tests with scripted actions,Analysis,Runs many Vusers on few machines,Replaces testers with Virtual Users,Controller manages Virtual Users,Database server,Vusers,Virtual User load generator,Application server,Load Generation,System Under Test,Lo
8、adRunner的实现方法,LoadRunner is a complete solution to conduct automated load testing before, during, and after application deployment. LoadRunner allows you to.,Scale,Identify,Diagnose,the application to a predetermined capacity.,business processes or system components having trouble.,a problem to pinp
9、oint the root cause.,LR VUGEN,Vuser Script Recorder records Vuser scripts that simulate the steps of real users using the application.,LR CONTROLLER,The Controller is an administrative center for creating, maintaining and executing Scenarios. The Controller assigns Vusers and load generators to Scen
10、arios, starts and stops load tests and performs other administrative tasks.,LR ANALYSIS,LR Analysis provides graphs and reports. These graphs and reports summarize the system performance.,LoadRunner 组件,LoadRunner 支持的环境,Web: HTTP(S) CORBA WAP COM RMI LDAP Winsock Streaming FTP IIOP POP3 iMode RealPla
11、yer MS Media Voice XML SMTP,Databases: Oracle MS SQLServer DB2 Sybase Informix ODBC,Middleware Protocols: CORBA COM EJBs TUXEDO Jolt JDBC MQSeries,Platforms: NT, 2000, XP Sun HP IBM Linux,ERP/CRM: Oracle Apps. SAP Siebel PeopleSoft Clarify Baan,Legacy: 3270 5250 VT100,Internet/Intranet,Database serv
12、er,App servers,Web servers,Clients,什么是 Scenario?,Scenario A scenario is a file that defines which Vusers to execute, the number of Vusers to run, the goals of the test, which computer hosts the Vusers and the conditions under which to run the load test.,LoadRunner的工作方式,Database server,App servers,We
13、b servers,LR CONTROLLER,LOAD GENERATOR 2 (NY),LR ANALYSIS,LOAD GENERATOR 1 (SF),Create scenarios and assign them to load generators.,Generates load and sends performance data to controller.,Access the reports and graphs.,Generates load and sends performance data to controller.,硬件配置需求,压力测试流程,Define G
14、oals Analyze system Gather System Usage Data,Record Scripts and turn scripts into Vusers by adding test data and user behavior,Create Scenarios based on your goals,Execute Scenarios for testing first, running 100% and overloading,Analyze results data and pinpoint bottlenecks,Fine tune system based o
15、n analysis data and re-run the scenario,Tweak System Based on Analysis,Rerunning the scenario indicates whether performance has improved and whether goals have been achieved.,压力测试是一项团队工作,LoadRunner 团队工作,Tweak System Based on Analysis,LR Expert,LR Expert,LR Expert,LR Expert,LR Expert,返回大纲,第二节,规划,在创建脚
16、本之前要进行充分的规划,规划阶段的内容,建立负载测试的目标 制定出可以用数量衡量的目标标准 分析被测系统的业务运行状况 确定要录制哪些商业流程(business processes) 确定业务高峰的负载情况和时间 把需要测试的BP的操作步骤形成正式文档 准备测试数据 收集系统的技术信息 确定系统的架构 确定系统各部件的软件情况,使用什么样的数据库服务器?Web服务器? 以帮助我们在合理的时间内确定系统瓶颈,本次培训使用的Demo软件,Start Programs Mercury Tours,返回大纲,第三节,编写脚本,录制Web脚本的方法,1. 运行VuGen,创建新的脚本,4. 开始录制,5
17、. 进行正常的业务流程的操作,6. 当业务操作完毕后,按Stop Recording将录制结束,7. 保存脚本,2. 选择创建Web(HTTP/HTML) protocol的脚本,3. 设定录制选项 Recording Options.,DEMO 老师将会演示如何录制脚本,设定录制选项 Recording Options,Recording Browser Recording Proxy Advanced Correlation,DEMO Recording Options,两种不同查看脚本的方式,Tree View,Script View,Tree view has icons for th
18、e recorded user steps,Each Tree View icon represents a C statement viewable in Script View,DEMO Tree and Script View Icon and usage examples,什么时候选择不同的录制方式?,This is default mode. If problem encountered with form submission or with link clicking then record with URL option checked under HTML Advanced,
19、HTML Recording:,URL Recording:,Records a separate request for each object requested from the server. Gives best control over traffic.,脚本的目录结构,设置回放的运行时刻设置 Run-time Settings,Run Logic Pacing Log Think Time Miscellaneous Speed Simulation Browser Emulation Proxy Preferences ContentCheck,Available for al
20、l protocols.,Specific to Web.,DEMO Run-time Settings,运行脚本,Click the Run button to play back the script.,The Execution log lists all messages once the script has stopped running.,DEMO Running a script and how to set results directory,常用的调试脚本的工具,Test Results window Execution Log Snapshot Results windo
21、w Page View Server Response Client Request Run-Time Viewer,DEMO Available debugging tool options,本节总结,本节介绍了常用的录制选项 本节介绍了两种录制Web协议脚本的方法 本节介绍了运行时刻的各种设定 本节介绍了一般选项的设定 本节介绍了进行调试脚本的基本工具,Action A set of recorded user actions in a Vuser that allows you to emulate a particular user task through script iterat
22、ion.,什么是Action?,在Web脚本里面使用多个Action,A Web Vuser (script):,vuser_init Run once,Action Run 3 times,vuser_end Run once,Action1 Run 5 times,Action2 Run 4 times,then,then,then,then,使用多个 Action的典型例子,最典型的情况是用户登录一次,进行多次业务,然后退出系统: Record Login user steps in vuser_init Record selecting an item in the first sec
23、tion called Action Record placing items in shopping cart user steps in Action1 Record Checkout and Logout user steps in vuser_end,Web server,DB server,如何把不同的操作录制到多个 Actions中?,Action list,1. Start recording 2. Select action file 3. Record users steps in the appropriate action file 4. Repeat steps 2 a
24、nd 3 as necessary 5. Stop recording,DEMO Adding creating LR Actions,注意设定好开始和结束的状态,Always end at this page if the next iteration is Sign-On or Register.,根据测试目标来确定脚本的Action,Emulate three types of users where 50% of the users are logging in, 25% are searching and the remaining 25% are booking tickets?,
25、Load Testing Goal:,Record one script with all three business processes under separate actions and apply weighting.,Suggested method:,DEMO Creating Weighting,如何衡量操作的响应时间?,STEP 1,Start Application,STEP 2,Type username and password,STEP 3,Click on Sign-In button,STEP 4,Wait for confirmation,STEP 5,Sele
26、ct a departure and arrival cities,STEP 6,Enter dates,STEP 7,Enter credit card details,STEP 8,Click on Submit,什么是Transaction?,LoadRunner Transaction Gives an end-to-end measurement of time elapsed in the execution of one or more steps in a business process.,User,Web Server,Sign-In transaction took 8
27、sec,LoadRunner的Transactions测量什么内容?,LoadRunner transactions measure the transmission and response time between client and server.,Transaction开始和结束按钮,Transaction的状态,LR_AUTO (default) - use this to detect the transaction status automatically,LR_PASS / LR_FAIL / LR_STOP use these when you want to set th
28、e transaction status manually in the code,Transactions中的思考时间如何处理?,Think times May reduce accuracy of transaction measurements Can be filtered out of Analysis graphs,通过检查运行日志来确定 Transaction的执行结果,Transactions的相关设定,参数化的概念,Recorded Script,Select San Francisco,Parameterized Script,Select ,Selection is ha
29、rd coded and will select San Francisco on every run,Selection is parameterized and will select different city on every run,为什么要引入“参数化”?,REAL USERS,Varied input to the application,Static input to the application,Recorded script (Virtual Users),To Emulate real-world behavior and to create realistic re
30、sults,什么时候需要参数化?,STEP 1,Start Application,STEP 2,Type username and password,STEP 3,Click on Sign-In button,STEP 4,Wait for confirmation,STEP 5,Select a departure and arrival cities,STEP 6,Enter dates,STEP 7,Enter credit card details,STEP 8,Click on Submit,Unique constraint,Data dependency,Data cachi
31、ng,Date constraint,如何参数化输入数据,1 Determine which fields to parameterize. 2 Replace recorded values with parameters. 3 Decide which parameter type to use. 4 Create the data file. 5 Populate the data file. 6 Choose the data access method and the number of iterations. 7 Run the Vuser and analyze the resu
32、lts to verify correct execution.,DEMO How to parameterize a input data,参数的类型,Internal Data Data Files Master Data User Generated Data External Data User-Defined Functions,Specifying the source for the parameter data. There are three types:,File类型参数的数据访问方式,Select next tells LoadRunner in what order t
33、o use data from the file (data source),如何查看脚本执行时参数的值?,To see parameter data in the Execution Log, select Extended log and Parameter substitution in the Run-time Settings,数据个数和Run Logic的关系,To test all data using the Sequential access method, Number of Iterations should equal the number of rows in the
34、 data file,什么是检查点 Checkpoint?,Checkpoint A checkpoint is a step in a Vuser script which verifies whether a visual cue appeared as expected.,Verification always results in a PASS or FAIL status,在大并发用户压力的情况下验证脚本是否执行成功是负载测试的基本要求,Success. Business process complete.,Failure. Business process failed.,One
35、Vuser running the script,Script run under load with many concurrent Vusers,Increase in load,Low load,确定脚本执行成功的标准,Login,Select departure and arrival cities,Select departure and arrival dates,Select flight,Purchase ticket,Continue Shopping,There was an error while generating your order!,Your itinerary
36、 was booked! Thank you for choosing Mercury Tours.,通过界面的某些信息来确定脚本是否执行成功,(2) On playback, compare the actual value on the application to the saved expected value.,(3) Send the comparison result (the status) as either PASS Test requirement # 5 successful. OR FAIL Test requirement # 5 failed.,(1) Captu
37、re the information needed to perform verification.,检查点的基本内容,Expected Value,Actual Value,PASS,=,IF,LoadRunner提供的文本检查点,Checkpoint Icons,Text,VuGen allows you to add Checkpoints for verification automatically and also programmatically.,A text check is a search for a specified text string on a Web page.
38、 Adds web_reg_find function to the script.,关联的基本概念介绍 Recording,Web Server,1.Log in User Name jojo Password bean 2.Your sessionid12345 3.Request for product info 4.Product info found,VuGen Script,Dynamic data is hard-coded in the script,关联的基本概念介绍 - Playing Back,Web Server,1.Login User Name jojo Passw
39、ord bean 2.Your sessionid12345 3.Request for product info 4.Product info found,Response,ERROR SessionID 12345 has expired Login again to get product info,VuGen Script,Reusing recorded dynamic data will cause errors when you replay the script,关联的基本概念介绍 - Solution,Web Server,1. 2.Your 3. 4. ,Correlate
40、d VuGen Script,Recorded dynamic data must be correlated using parameters,关联是一个原理性的问题,2,1,3,关联是一个原理性的问题,在任何协议的脚本中都存在,关联是开发脚本的最耗时,最烦琐的一个过程. 因为每个被测系统都不同,为了减轻关联的工作量,LoadRunner提供了一些自动化关联的辅助工具,手工关联的基本步骤,Play back the script and determine if error is due to correlation. Determine which dynamic values to co
41、rrelate. Find the left boundary, right boundary and occurrence of the dynamic value. Add a web_reg_save_param function and the arguments to the script, above the step which requests the page with the value to capture. Parameterize the dynamic value in the script every time it occurs. Verify correct
42、execution.,关联的第一步:脚本回放失败,Q: Why did the step creation fail? 1. Make a note of which step failed. 2. Investigate the Execution Log.,通过WDiff查看脚本变化的内容,There are five differences highlighted.,确定哪些动态信息需要关联,Name=buyFlights.x, Value=52, ENDITEM, Name=buyFlights.x, Value=23, ENDITEM, Name=buyFlights.y, Valu
43、e=15, ENDITEM, Name=buyFlights.y, Value=17, ENDITEM, lr_think_time( 2 ); lr_think_time( 1 ); lr_think_time( 7 ); lr_think_time( 11 ); Name=flight_210, Value=on, ENDITEM, Name=flight_206, Value=on, ENDITEM, Name=removeSelected.x, Value=101, ENDITEM, Name=removeSelected.x, Value=80, ENDITEM, Name=remo
44、veSelected.y, Value=13, ENDITEM, Name=removeSelected.y, Value=10, ENDITEM, lr_think_time( 1 );,1,2,3,4,5,These values represent the screen locations of mouse clicks They are used by the script but do not need to be correlated,Think times are used by the script but do not need to be correlated,Flight
45、 number is dynamic and requires correlation,关联函数: web_reg_save_param,(param_name, *, LAST);,User-defined parameter name,Indicates no more attributes,Optional indicates ordinal or instance or the match,The left Res = (ab? b:a)c? c:(ab? b:a); return Res; 该动态链接库编译成功后,打开dllfortest工程目录下的debug目录下,可以看到生成了一
46、个dllfortest.dll文件,这就是我们想要的文件。,调用动态库dll,2、dll文件在LR中的调用 打开LR VU Generator,选择C Vuser协议(或其他支持C的协议),进入编辑界面。Action部分如下所示: Action() lr_load_dll(dllfortest.dll); lr_message(Max Result is %d,Max(100,200,67); lr_message(Min Result is %d,Min(55,97,63); return 0; 将dllfortest.dll文件复制到脚本所在的目录(如果不复制的话,lr_load_dll的
47、参数应该写成dll文件的绝对路径),如果编译没有报错的话,就可以直接运行了。,第四节,Scenario 设计,Understanding Scenarios Scheduling Scenarios Runtime Settings Performance Monitors,目标,Tweak System Based on Analysis,什么是 Scenario?,Scenario A scenario is a file that defines which Vusers to execute, the number of Vusers to run, the goals of the
48、test, which computer hosts the Vusers and the conditions under which to run the load test.,LoadRunner Controller,Before scenario execution used to design scenario used to initiate scenario run,During scenario execution runs many Vusers simultaneously controls each Vuser (initialize, run, pause, stop
49、) displays execution status of each Vuser displays messages from each Vuser monitors system and network resources After scenario execution collects and organizes performance data launches the Analysis tools,Controller organizes and manages scenario elements,DEMO Controller,选择 Scenario 类型,Choose one
50、of these types when you start a new scenario: Manual Goal-Oriented,DEMO Scenario Types,Manual Scenario main purpose is to learn how many Vusers can run concurrently gives you manual control over how many Vusers run and at what times Goal-Oriented Scenario goal may be throughput, response time or num
51、ber of concurrent Vusers LoadRunner manages Vusers automatically,Manual 与 Goal-Oriented Scenarios 比较,选择哪一种 Scenarios 类型?,Scenario Outline,Scenario Type,Manual scenario with 1,000 concurrent Vusers,Goal-Oriented scenario with Transaction Response Time as the Goal Type,Scheduling Scenarios,Allows repe
52、tition of important usage patterns throughout load testing for defined duration of load test.,DEMO How to access Schedule Builder,Schedule by Scenario,Applies same schedule across all groups Allows delay in start time for scenario Creates a profile of usage by “users”,Schedule by Group,Individual se
53、ttings for each group Allows delay in start time for scenario Creates a profile of usage by “business process”,Ramp Up 与 Ramp Down,Ramp Up,Ramp Down Only applicable for scenarios where in the Duration tab Run for option is selected Specify how many Vusers to stop and how often Stop all Vusers at onc
54、e Primarily used to detect memory leak and system recovery after heavy load,Allows loading all Vusers in the scenario gradually Timed increments pinpoint the exact point at which a system/software fails or degrades,什么是 Run-time Setting,Run-time Settings can be configured in VuGen and in the Controll
55、er Different Groups of Vusers many have different Run-time Settings Run-time Settings greatly affect Vuser behavior Run-time Settings greatly affect Vuser “footprints”,Run-time Settings,Run Logic Pacing Log Think-Time Miscellaneous,DEMO How to access Run-time Settings,Run Logic 与 Pacing,Controls the
56、 delay between iterations Can be used to extend the amount of time a test runs,Used to model more closely the way real users interact with the application,Run Logic,Replicates a real user performing steps in a business process more than once Allows setting of the iteration count (how many times a Vu
57、ser will repeat a task),Pacing,Log 设置,In Controller, logging is enabled by default to send messages only when there is an error Used for Vuser information such as error messages parameter substitution transaction status verification status,Think Time,Think Time introduces the right amount of delay t
58、o emulate user behavior accurately Allows replaying or ignoring of recorded Think Time (default = replay) Influences how the Vuser uses the recorded Think Time Ignoring Think Time will greatly affect the scalability of the load generators,Miscellaneous Settings,Error Handling Continue on Error allows Vusers to attempt to proceed past an error. It is used when Error Handling has been added to the script manually. By default, Continue on Error is off. Multithreading Threading supports more Vusers per load generator Process supports Vuse
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 新形势下金属制太阳能、风能等新能源船舶行业顺势崛起战略制定与实施分析报告
- 2026护士当辅警面试题及答案
- 外包团队绩效考核通知的函(8篇范文)
- 品牌经理品牌认知度与市场占有率考核表
- 预防欺诈守护财产五年级主题班会课件
- 职场新人商务邮件撰写与沟通技巧指导书
- 2026年景德镇陶瓷大学管理助理、教学助理、科研助理岗位招聘28人备考题库(模拟题)附答案详解
- 2026江西赣州定南县城建投资集团有限公司下属经营性子公司招聘5人笔试题库含答案详解【突破训练】
- 2026重庆市綦江区扶欢镇人民政府公益性岗位人员招聘1人(7-3)备考题库附参考答案详解(A卷)
- 2026贵州贵阳市乌当区民政局公益性岗位招聘1人笔试题库附参考答案详解(基础题)
- 2026年小红书爆款笔记创作公式与算法机制
- 2026-2030中国羟基乙酸行业竞争状况与应用趋势预测报告
- 江苏无锡市2025-2026学年高二下学期期末考试数学试题
- 2026年消防知识和技能考试试题及答案
- 物业工程标准化运维培训体系
- 2026年教师招聘面试试讲真题(高中生物)
- 2026年金属非金属矿山(露天矿山)安全管理人员试题附答案详解【考试直接用】
- 花篮式悬挑脚手架监理实施细则范本
- 创意与策划课程大纲
- 【答案】《深度学习及其应用》(复旦大学)章节期末慕课答案
- 深度解析(2026)《TBT 3211-2009机车车辆用铸钢件射线照相检验参考图谱》
评论
0/150
提交评论