




版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、2021/2/61 LoadRunner Quick Tutorial LR78-SLIDES-01A 2021/2/62 大綱 oLoad runner介紹 o規(guī)劃 o編寫腳本 腳本錄制、調(diào)試、優(yōu)化腳本錄制、調(diào)試、優(yōu)化 o場景設計場景設計 用戶數(shù)、場景類型、場景計劃、運行設置、實時監(jiān)控用戶數(shù)、場景類型、場景計劃、運行設置、實時監(jiān)控 o場景執(zhí)行場景執(zhí)行 調(diào)試場景、小壓力運行、調(diào)試場景、小壓力運行、100%負載測試、壓力測試負載測試、壓力測試 o結果分析結果分析 常用指標觀察、生成測試報告常用指標觀察、生成測試報告 2021/2/63 第一節(jié) LoadRunner 介紹介紹 2021/2/64
2、為什么要進行壓力測試 oThe failure of a mission-critical application can be costly oAssure performance and functionality under real-world conditions oLocate potential problems before your customers do oReduce development time oReduce infrastructure costs 2021/2/65 壓力測試分類 Find out whether the system can handle
3、the expected load upon deployment under real-world conditions. Find the applications breaking point. Apply testing that measures whether the applications environment is properly configured to handle expected or potentially unexpected high transaction volumes. Load Testing Stress Testing Find the sta
4、bility of the system with respect to handling large amounts of data over extended time periods. Volume Testing Find the behavior and performance of each tier. Componen t Testing 2021/2/66 壓力測試目標舉例 pApplication response time How long does it take to complete a task? p Configuration sizing Which confi
5、guration provides the best performance level? p Acceptance Is the system stable enough to go into production? p Regression Does the new version of the software adversely affect response time? p Reliability How stable is the system under a heavy work load? p Capacity planning At what point does degra
6、dation in performance occur? p Bottleneck identification What is the cause of degradation in performance? p Product evaluation What is the best server for 100 users? 2021/2/67 Tester s Load Generation System Under Test Do you have the testing resources? Testing personnel Client machines How do you s
7、ynchronize users? How do you collect and analyze results? How do you achieve test repeatability? Everybody , click the SEARCH button again 手工測試的問題 Coordinato r Databas e server Applicatio n server 2021/2/68 LoadRunner解決方案 Overcomes resource limitations Provides meaningful results with analysis tools
8、 Allows repeatable tests with scripted actions Analysi s Runs many Vusers on few machines Replaces testers with Virtual Users Controller manages Virtual Users Databas e server Controller Vusers Virtual User load generat or Applicatio n server Load Generation System Under Test 2021/2/69 LoadRunner的實現(xiàn)
9、方法 LoadRunner is a complete solution to conduct automated load testing before, during, and after application deployment. LoadRunner allows you to. ScaleIdentif y Diagnos e the application to a predetermined capacity. business processes or system components having trouble. a problem to pinpoint the r
10、oot cause. 2021/2/610 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 Sce
11、narios, 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 組件 2021/2/611 LoadRunner 支持的環(huán)境 Web: HTTP(S) CORBA WAP COM RMI LDAP Winsock Streamin g FTP IIOP POP3
12、iMode RealPlaye r MS Media Voice XML SMTP Databases: Oracle MS SQLServer DB2 Sybase Informix ODBC Middleware Protocols: CORBA COM EJBs TUXEDO Jolt JDBC MQSeries Platform s: NT, 2000, XP Sun HP IBM Linux ERP/CRM: Oracle Apps. SAP Siebel PeopleSoft Clarify Baan Legacy: 3270 5250 VT100 Internet/Intrane
13、tDatabase server App servers Web servers Clients 2021/2/612 什么是 Scenario? scripts run-time settings load generators real-time monitors virtual users Elements of a Scenario Scenario A scenario is a defines which Vusers to execute, the number of Vusers to run, the goals of the test, which computer hos
14、ts the Vusers and the conditions under which to run the load test. 2021/2/613 LoadRunner的工作方式 Database server App servers Web servers LR CONTROLLER LOAD GENERATOR 2 (NY) LR ANALYSIS LOAD GENERATOR 1 (SF) 1.Create scenarios and assign them to load generators. 2.Generates load and sends performance da
15、ta to controller. 3. Access the reports and graphs. 2.Generates load and sends performance data to controller. Performance metrics 2021/2/614 硬件配置需求 Win NT Win 2000 Win XP 500 MB Win NT Win 2000 Win XP UNIX Depends on the number of Vusers and runtime settings. Win NT Win 2000 Win XP 200 MB Operating
16、 System Free Hard Disk Space 256 MB256 MB256 MBMemory AnalysisLoad Generator ControllerLR Components 2021/2/615 壓力測試流程 Define Goals Analyz e system Gather Syste m Usage Data Record Scripts and turn scripts into Vusers by adding test data and user behavior Create Scenarios based on your goals Execute
17、 Scenarios for testing first, running 100% and overloadin g Analyze results data and pinpoint bottlenec ks Fine tune system based on analysis data and re-run the scenario Tweak System Based on Analysis Plan Load Test 1 Create Virtual Users 2 Scenario Creation 3 Scenario Execution 4 Results Analysis
18、5 Rerunning the scenario indicates whether performance has improved and whether goals have been achieved. 2021/2/616 壓力測試是一項團隊工作 Manages the test application implementation for all phases of load testing Provides expertise on the business functionality of the application under test for planning phas
19、e Team MemberMain Responsibility Project Manager Functional Expert Creates the multi-user load on the system for all phases of load testing LoadRunner Expert Analyzes and tunes the application server for results analysis phase Application Server Performance Basis Expert Analyzes and tunes the databa
20、se server for results analysis phase Database Performance Basis Expert 2021/2/617 LoadRunner 團隊工作 Tweak System Based on Analysis Plan Load Test 1 Create Virtual Users 2 Scenario Creation 3 Scenario Execution 4 Results Analysis 5 LR Expert Functiona l Expert Project Manag er LR Expert Functiona l Exp
21、ert Project Manag er LR Expert LR Expert Sys Admin Server Expert(s ) Sys Admin Server Expert(s ) LR Expert 返回大綱返回大綱 2021/2/618 第二節(jié) 規(guī)劃規(guī)劃 2021/2/619 在創(chuàng)建腳本之前要進行充分的規(guī) 劃 Plan Load Test 1 Create Virtual Users 2 Scenario Creation 3 Scenario Execution 4 Results Analysis 5 Goals, business processes, user type
22、, user behaviors, input data, system profiling, scenario design, and LoadRunner installation 2021/2/620 規(guī)劃階段的內(nèi)容 1. 建立負載測試的目標 制定出可以用數(shù)量衡量的目標標準 2. 分析被測系統(tǒng)的業(yè)務運行狀況 確定要錄制哪些商業(yè)流程(business processes) 確定業(yè)務高峰的負載情況和時間 把需要測試的BP的操作步驟形成正式文檔 準備測試數(shù)據(jù) 3. 收集系統(tǒng)的技術信息 確定系統(tǒng)的架構 確定系統(tǒng)各部件的軟件情況,使用什么樣的數(shù)據(jù)庫服務器?Web 服務器? 以幫助我們在合理的時間內(nèi)
23、確定系統(tǒng)瓶頸 2021/2/621 本次培訓使用的Demo軟件 Start Programs Mercury Tours Before you access the training application: Invoke the Apache Server (Start Programs Start Server) 返回大綱返回大綱 2021/2/622 第三節(jié) 編寫腳本編寫腳本 2021/2/623 錄制Web腳本的方法 1. 運行VuGen,創(chuàng)建新的腳本 4. 開始錄制 5. 進行正常的業(yè)務流程的操作 6. 當業(yè)務操作完畢后,按Stop Recording將錄制結束 7. 保存腳本 2.
24、 選擇創(chuàng)建Web(HTTP/HTML) protocol的腳本 3. 設定錄制選項 Recording Options. DEMO 老師將會演示如何錄制腳本 2021/2/624 設定錄制選項 Recording Options Recording Browser Recording Proxy Advanced Correlation DEMO Recording Options 2021/2/625 兩種不同查看腳本的方式 Tree View Script View Tree view has icons for the recorded user steps Each Tree View
25、 icon represents a C statement viewable in Script View DEMO Tree and Script View Icon and usage examples 2021/2/626 什么時候選擇不同的錄制方式? This is default mode. If problem encountered with form submission or with link clicking then record with URL option checked under HTML Advanced HTML Recording: URL Recor
26、ding: Records a separate request for each object requested from the server. Gives best control over traffic. 2021/2/627 腳本的目錄結構 C: web_project - Scripts - - Action1.c vuser_init.c vuser_end.c Lab1Script2.usr As soon as the script is saved, these are the folders that you will see Lab1Script2 2021/2/6
27、28 設置回放的運行時刻設置 Run-time Settings Run Logic Pacing Log Think Time Miscellaneous Speed Simulation Browser Emulation Proxy Preferences ContentCheck Available for all protocols. Specific to Web. DEMO Run-time Settings 2021/2/629 運行腳本 Click the Run button to play back the script. The Execution log lists
28、all messages once the script has stopped running. DEMO Running a script and how to set results directory 2021/2/630 常用的調(diào)試腳本的工具 Test Results window Execution Log Snapshot Results window Page View Server Response Client Request Run-Time Viewer DEMO Available debugging tool options 2021/2/631 本節(jié)總結 o本節(jié)介
29、紹了常用的錄制選項 o本節(jié)介紹了兩種錄制Web協(xié)議腳本的方法 o本節(jié)介紹了運行時刻的各種設定 o本節(jié)介紹了一般選項的設定 o本節(jié)介紹了進行調(diào)試腳本的基本工具 2021/2/632 Action A set of recorded user actions in a Vuser that allows you to emulate a particular user task through script iteration. 什么是Action? 2021/2/633 在Web腳本里面使用多個Action A Web Vuser (script): Search for a CDOrder t
30、he CD Log in Go to checkout vuser_init Run once Action Run 3 times vuser_end Run once Search for a DVDOrder the DVD Action1 Run 5 times Search for a book Order the book Action2 Run 4 times then then then then 2021/2/634 使用多個 Action的典型例子 最典型的情況是用戶登錄一次,進行多次業(yè)務,然后退出系統(tǒng): nRecord Login user steps in vuser_
31、init nRecord selecting an item in the first section called Action nRecord placing items in shopping cart user steps in Action1 nRecord Checkout and Logout user steps in vuser_end Internet Web server DB server 2021/2/635 如何把不同的操作錄制到多個 Actions中? Action list 1. Start recording 2. Select action file 3.
32、Record users steps in the appropriate action file 4. Repeat steps 2 and 3 as necessary 5. Stop recording DEMO Adding creating LR Actions 2021/2/636 注意設定好開始和結束的狀態(tài) Always end at this page if the next iteration is Sign-On or Register. 2021/2/637 根據(jù)測試目標來確定腳本的Action Emulate three types of users where 50%
33、 of the users are logging in, 25% are searching and the remaining 25% are booking tickets? Load Testing Goal: Record one script with all three business processes under separate actions and apply weighting. Suggested method: DEMO Creating Weighting 2021/2/638 如何衡量操作的響應時間? How can I isolate a measurem
34、ent of just the Sign-in response time? 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 7Enter credit card details STEP 8 Click on Submit 2021/2/639 什么是Transacti
35、on? LoadRunner Transaction Gives an end-to-end measurement of time elapsed in the execution of one or more steps in a business process. 2021/2/640 User Web Server Request (Transaction starts) Response (Transaction ends) Sign-In transaction took 8 sec LoadRunner的Transactions測量什 么內(nèi)容? LoadRunner transa
36、ctions measure the transmission and response time between client and server. 2021/2/641 Transaction開始和結束按鈕 Common icons and usage examples Start Transaction Set starting point for measurement End Transaction Set end point for measurement 2021/2/642 Transaction的狀態(tài) nLR_AUTO (default) - use this to det
37、ect the transaction status automatically n LR_PASS / LR_FAIL / LR_STOP use these when you want to set the transaction status manually in the code 2021/2/643 Transactions中的思考時間如何 處理? Think times May reduce accuracy of transaction measurements Can be filtered out of Analysis graphs 2021/2/644 通過檢查運行日志
38、來確定 Transaction的執(zhí)行結果 2021/2/645 Transactions的相關設定 2021/2/646 參數(shù)化的概念 Recorded Script Select San Francisco Parameterized Script Select Selection is hard coded and will select San Francisco on every run Selection is parameterized and will select different city on every run 2021/2/647 為什么要引入“參數(shù)化”? REAL
39、USERS Varied input to the application Static input to the application Recorded script (Virtual Users) To Emulate real-world behavior and to create realistic results 2021/2/648 什么時候需要參數(shù)化? STEP 1 Start Application STEP 2Type username and password STEP 3 Click on Sign-In button STEP 4Wait for confirmat
40、ion STEP 5Select a departure and arrival cities STEP 6 Enter dates STEP 7Enter credit card details STEP 8Click on Submit Unique constraint Data dependency Data caching Date constraint 2021/2/649 如何參數(shù)化輸入數(shù)據(jù) 1 Determine which fields to parameterize. 2 Replace recorded values with parameters. 3 Decide w
41、hich 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 results to verify correct execution. DEMO How to parameterize a input data 2021/2/650 參數(shù)的類型 Internal Data Data Files Master Data
42、 User Generated Data External Data User-Defined Functions Specifying the source for the parameter data. There are three types: 2021/2/651 File類型參數(shù)的數(shù)據(jù)訪問方式 Sequential Random Unique Same line as Select next tells LoadRunner in what order to use data from the file (data source) 2021/2/652 如何查看腳本執(zhí)行時參數(shù)的值?
43、 To see parameter data in the Execution Log, select Extended log and Parameter substitution in the Run-time Settings 2021/2/653 數(shù)據(jù)個數(shù)和Run Logic的關系 To test all data using the Sequential access method, Number of Iterations should equal the number of rows in the data file 2021/2/654 什么是檢查點 Checkpoint? C
44、heckpoint 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 2021/2/655 在大并發(fā)用戶壓力的情況下驗證腳本 是否執(zhí)行成功是負載測試的基本要求 Success. Business process complete. Failure. Business process failed. One Vuser running the s
45、cript Script run under load with many concurrent Vusers Increase in load Low load 2021/2/656 What indicates the ticket was purchased successfully? ? 確定腳本執(zhí)行成功的標準 Login Select departure and arrival cities Select departure and arrival dates Select flight Purchase ticket Continue Shopping There was an e
46、rror while generating your order! Your itinerary was booked! Thank you for choosing Mercury Tours. 2021/2/657 通過界面的某些信息來確定腳本是否 執(zhí)行成功 Flight confirmation image and text appear after pressing the Secure Purchase button. Image Confirmation Text Confirmation 2021/2/658 (2) On playback, compare the actual
47、 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) Capture the information needed to perform verification. 檢查點的基本內(nèi)容 Expecte d Value Actual Value PASS IF 2021/2/659
48、 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. Adds web_reg_find function to the script. 2021/2/660 關聯(lián)的基本概念介紹 Recording Web Server Login (User
49、Name jojo Password bean) Response (SessionID12345 ) 1.Log in User Name jojo Password bean 2.Your sessionid12345 3.Request for product info 4.Product info found Response Product info VuGen Script Request for product info (SessionID12345 ) Dynamic data is hard-coded in the script 2021/2/661 關聯(lián)的基本概念介紹
50、- Playing Back Web Server Login (User Name jojo Password bean) Response (SessionID23456 ) 1.Login User Name jojo Password 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 Request for pro
51、duct info (SessionID12345 ) Reusing recorded dynamic data will cause errors when you replay the script 2021/2/662 關聯(lián)的基本概念介紹 - Solution Web Server Login (User Name jojo Password bean) Response (SessionID23456 ) Request for product info () Response Here is the requested product info 1. 2.Your 3. 4. Co
52、rrelated VuGen Script Recorded dynamic data must be correlated using parameters 2021/2/663 關聯(lián)是一個原理性的問題 2 1 3 關聯(lián)是一個原理性的問題,在任何協(xié)議 的腳本中都存在 關聯(lián)是開發(fā)腳本的最耗時,最煩瑣的一個 過程. 因為每個被測系統(tǒng)都不同 為了減輕關聯(lián)的工作量,LoadRunner提 供了一些自動化關聯(lián)的輔助工具 2021/2/664 手工關聯(lián)的基本步驟 1.Play back the script and determine if error is due to correlation. 2.
53、Determine which dynamic values to correlate. 3.Find the left boundary, right boundary and occurrence of the dynamic value. 4.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. 5.Parameterize the dynamic value in the sc
54、ript every time it occurs. 6.Verify correct execution. 2021/2/665 關聯(lián)的第一步:腳本回放失敗 Q: Why did the step creation fail? 1. Make a note of which step failed. 2. Investigate the Execution Log. 2021/2/666 通過WDiff查看腳本變化的內(nèi)容 There are five differences highlighted. 2021/2/667 確定哪些動態(tài)信息需要關聯(lián) Name=buyFlights.x, Val
55、ue=52, ENDITEM, Name=buyFlights.x, Value=23, ENDITEM, Name=buyFlights.y, Value=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.
56、x, Value=101, ENDITEM, Name=removeSelected.x, Value=80, ENDITEM, Name=removeSelected.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 T
57、hink times are used by the script but do not need to be correlated Flight number is dynamic and requires correlation 2021/2/668 關聯(lián)函數(shù): 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 使用DLL的
58、另一個優(yōu)點是DLL文件作為 一個單獨的程序模塊,封裝性、獨立性好,在軟件需要升級的時候, 開發(fā)人員只需要修改相應的DLL文件就可以了,而且,當DLL中的 函數(shù)改變后,只要不是參數(shù)的改變,程序代碼并不需要重新編譯。 這在編程時十分有用,大大提高了軟件開發(fā)和維護的效率。 o 在LR下也可以直接調(diào)用動態(tài)鏈接庫文件,針對一些使用LR腳本編 寫比較煩瑣的方法可以考慮此方法(比如各種加解密算法的實 現(xiàn),數(shù)據(jù)庫的操作等),并能夠使測試腳本簡單明了。鑒于此,本 人初次嘗試了如何制作DLL文件并在LR中使用。 2021/2/673 調(diào)用動態(tài)庫dll oint Min(int a, int b, int c) o
59、 o int Res; o Res = (ab? b:a)c? c:(ab? b:a); o return Res; o o該動態(tài)鏈接庫編譯成功后該動態(tài)鏈接庫編譯成功后,打開打開dllfortest工程目錄下的工程目錄下的debug目錄目錄 下下,可以看到生成了一個可以看到生成了一個dllfortest.dll文件文件,這就是我們想要的文件。這就是我們想要的文件。 2021/2/674 調(diào)用動態(tài)庫dll o2、dll文件在文件在LR中的調(diào)用中的調(diào)用 o 打開打開LR VU Generator,選擇選擇C Vuser協(xié)議(或其他支持協(xié)議(或其他支持C的的 協(xié)議)協(xié)議),進入編輯界面。進入編輯界面
60、。Action部分如下所示部分如下所示: oAction() o o lr_load_dll(dllfortest.dll); o lr_message(Max Result is %d,Max(100,200,67); o lr_message(Min Result is %d,Min(55,97,63); o return 0; o o將將dllfortest.dll文件復制到腳本所在的目錄(如果不復制的文件復制到腳本所在的目錄(如果不復制的 話話,lr_load_dll的參數(shù)應該寫成的參數(shù)應該寫成dll文件的絕對路徑)文件的絕對路徑),如果編譯沒有如果編譯沒有 報錯的話報錯的話,就可以直
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 關于洗煤合同范例
- 臨時財務用工合同范本
- 各種勞務合同范本
- 中國掀起數(shù)字化浪潮的心得體會
- 醫(yī)學三基康復科模擬練習題
- 勞務合同范本務
- 醫(yī)院房屋建設施工合同范本
- 醫(yī)藥廠家銷售合同范本
- 美術基礎習題及參考答案
- 半包家裝合同范本
- 2024年山東外貿(mào)職業(yè)學院高職單招語文歷年參考題庫含答案解析
- 數(shù)字經(jīng)濟學導論-全套課件
- 司機安全駕駛培訓課件
- 硬化性肺泡細胞瘤-課件
- 簡明新疆地方史趙陽
- 狹窄性腱鞘炎中醫(yī)臨床路徑及表單
- Q∕SY 19001-2017 風險分類分級規(guī)范
- 智慧消防綜合解決方案
- 市場營銷組合策略及營銷戰(zhàn)略課件
- 信息技術基礎ppt課件(完整版)
- DGJ 08-70-2021 建筑物、構筑物拆除技術標準
評論
0/150
提交評論