Jmeter Performance Testing

43,124 views

Published on

Published in: Technology
71 Comments
148 Likes
Statistics
Notes
No Downloads
Views
Total views
43,124
On SlideShare
0
From Embeds
0
Number of Embeds
21,902
Actions
Shares
0
Downloads
2
Comments
71
Likes
148
Embeds 0
No embeds

No notes for slide
  • Performance testing is commonly conducted to accomplish the following:
    Evaluate against performance criteria
    Compare performance characteristics of multiple systems or system configurations
    Find the source of performance problems
    Support system tuning
    Find throughput levels
  • - To assess the system capacity for growth
    The load and response data gained from the tests can be used to validate the capacity planning model and assist decision making.
    - To identify weak points in the architecture
    The controlled load can be increased to extreme levels to stress the architecture and break it bottlenecks and weak components can be fixed or replaced
    - To detect obscure bugs in software
    Tests executed for extended periods can cause failures caused by memory leaks and reveal obscure contention problems or conflicts
    - To tune the system
    Repeat runs of tests can be performed to verify that tuning activities are having the desired effect – improving performance.
    - To verify resilience & reliability
    Executing tests at production loads for extended periods is the only way to access the systems resilience and reliability to ensure required service levels are likely to be met.
  • Performance Test: To determine or validate speed, scalability, and/or stability.
    Load Test: To verify application behavior under normal and peak load conditions.
    Stress Test: To determine or validate an application’s behavior when it is pushed beyond normal or peak load conditions.
    Endurance Test: To determine the performance characteristics of the product under test over an extended period of time.
    Volume/Capacity Test: To determine how many users and/or transactions a given system will support and still meet performance goals.
    Scalability Test: To measure system performance while steadily increasing user load.
  • Load Runner, commercial load testing tool from HP
    JMeter, an open source tool from Apache
    RPT, commercial load test tool from IBM
    NeoLoad, commercial, for Windows, Linux, Solaris
    Microsoft Visual Studio Team System 2010, commercial, for Windows, which includes Load Test Analyzer and Load Test Monitor tools.
    OpenLoad, commercial load testing tool and hosted service
    OpenSTA, an open source tool
    PureLoad, commercial, multiplatform load testing tool
    PushToTest TestMaker, an open source testing framework (load testing and more)
    QEngine, free and commercial, from AdventNet (free edition supports 5 virtual users)
    SQLQueryStress Performance Testing Tool, free, for testing SQL Server StressIT, commercial and free
    The Grinder, an open source tool
    Flood, open source from and for Apache
    WAPT, Web Application Testing tool, a commercial product, for Windows
    WatchMouse, commercial hosted load testing service
    WebKing, commercial, multiplatform
    WebServer Stress Tool, commercial and free, from Paessler
  • Performance Testing Life Cycle
  • Performance Testing Life Cycle
  • Jmeter Performance Testing

    1. 1. Apache Jmeter Tool www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts “Performance Testing using Apache JMeter”
    2. 2. 2www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts “Opportunities are everywhere, if choose to see them”
    3. 3. Chapter 1 3www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Introduction
    4. 4. What’s Inside 4www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts 1.1 - Overview of PerformanceTesting 1.2 - Purpose of PerformanceTesting 1.3 - KeyTypes of PerformanceTesting 1.4 - Goal of PerformanceTesting 1.5 - Pre-Requisites PerformanceTesting 1.6 - Performance Management 1.7 - PerformanceTesting Life Cycle 1.8 - Why to use performanceTesting tool? 1.9 - Performance Symptoms and Issues 1.10 - Typical order of Fixes 1.11 - Challenged with PerformanceTesting 1.12 - Gather Non-Functional Requirements 1.13 - Proof of Concept
    5. 5. Overview of Performance Testing 5www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Performance testing is an non-functional testing to determine the system responsiveness i.e. speed, stability, reliability and scalability. Speed - “How Fast?” Stability - “How Long?” Reliability - “How Often?” Scalability - “How Much?”
    6. 6. Purpose of Performance Testing 6www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Performance Testing ensures that your application works under real- world loads before your customers find out that it doesn't! GOAL/OBJECTIVE IS TO FIND THE BOTTLE NECK IN THE SYSTEM
    7. 7. Key Types of Performance Testing 7www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Load Testing Focus: “Response Time” Stress Testing Focus: “Response Time” and “Throughput" Volume/Capacity Testing Focus: “Response Time” Endurance Testing Focus: “Memory” Scalable Testing Focus: “Response Time” and “Throughput"
    8. 8. Goal of Performance Testing 8www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Access the Production Readiness.  Compare two platforms with the same software to see which performs better.  Compare Performance characteristics of system configurations.  Evaluate System against performance criteria.  Discover what parts of the application perform poorly and under what conditions.  Finding the source of performance problems.  Support system tuning.
    9. 9. Pre-Requisites Performance Testing 9www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Stable and defect-free dedicated environment.  Performance testing environment similar to production environment.  No other testing should be performed while Performance Testing.  Performance testing before going live.  Performance testing plan development.  Test Data Preparation.  Performance testing requirements gathering.  Application architecture.  Servers information.  Application usage information.  Performance Acceptance criteria.
    10. 10. Performance Management 10www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts There are two approaches of managing the performance testing activities: Reactive Approach Performance is only done after the System testing. Proactive Approach Performance parameter is analyzed and addressed in testing environment before it really impact the production system and fix it before launching the application.  Non-Functional Requirements Gathering phase  Design phase Development phase  Development phase  Test Execution phase  Maintenance
    11. 11. Performance Testing Life Cycle 11www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts The performance testing core activities are displayed as follows: Perform Tuning/Change Configuration Analyze Results Run Test Record Test Plan Prepare Test Environment Plan & Design Tests Identifying Acceptance Criteria Identifying Test Environment
    12. 12. Why to use performance Testing tool? 12www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Almost impossible without one!  Without tool relies on massive hardware and personnel to generate load. The cost of repeating a 'manual' test never diminishes. Without a tool, no end reports are created.  Reponses Time  CPU Utilization  Disk I/O  Network I/O  Other
    13. 13. Performance Symptoms and Issues 13www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Performance Symptoms Long response time Memory leaks High CPU usage Too many open connections Length queues for requests Too many table scans of database Database deadlocks Erroneous data returned HTTP errors Pages not available Page check errors • Poor database tuning. • Poor cache management. • Poor session management. Application Server • Poor server design. • Poor configuration & usage. Web Server • Insufficient indexing. • Fragmented databases. • Faulty application design. Database Server • Firewall throughput. • Load balancers, gateways, routers. Network Server
    14. 14. Typical order of Fixes 14www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Improve current application design: Algorithms, caching, DB calls, memory use.  Upgrade hardware: RAM, CPU, network bandwidth  Upgrade software infrastructure: OS, web server, database (database connection polling)  Upgrade system architecture: Client-server to basic n-tier, basic n- tier to enterprise n-tier, software and hardware changes, Use Apache HTTPD in front of Tomcat to serve static resources, Use hardware load balancing /SSL.
    15. 15. Challenged with Performance Testing 15www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Following is a list of challenges with Performance Testing:  Test environment setup  Collection and Analysis of huge data  Bottleneck root cause identification  Obtaining accurate results  Client involvement  Testing inside the firewall  Performance testing of new technologies  Testing on live environment  Expensive  Cooperative effort required (Product vendors, Architects, Developers, Testers, Database administrators, System administrators, Network administrators)
    16. 16. Gather Non-Functional Requirements 16www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Clear and complete requirements are mandatory for successful performance testing.  What we need to start the performance testing?  What is the type of application and its architecture?  What are the known current as well as previous performance bottlenecks?  Which application scenarios to be tested?  Requirement gathering from 3 areas: General Information Workload Model Performance Goals
    17. 17. Proof of Concept 17www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  To identify technical evaluation of the performance testing tool.  To determine scripting effort & feasibility.  To demonstrates the capabilities & pitfalls of the performance testing using testing tool. Prerequisites Process Deliverables POC Checklist Post-Test Phase: Analyze Results, Report, Retest Performance Test Execution Performance Test Build Scripting Test Environment Build Pre-Engagement NFR Capture Performance test execution checklist
    18. 18. Chapter 2 18www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Get Started
    19. 19. What’s Inside 19www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts 2.1 - What is Jmeter? 2.2 - What can you test in JMeter 2.3 - Installing Jmeter 2.4 - Setting up Environment 2.5 - Configuration Jmeter
    20. 20. What is Jmeter? 20www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Open source tool  Friendly GUI Design  Platform Independent  Full multithreading framework  Visualize Test Results  Easy Installation  Support multi-protocol  HTTP proxy recording server  Caching and offline analysis/replaying of test results Jmeter Works: Send request to target server Get statistics information of target server Generate test report in different format
    21. 21. What can you test in Jmeter? 21www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Apache Jmeter enables to perform functional, load, performance and regression tests on an application.  The application may be running on a Web server or it could be a standalone in nature.  It supports testing on both client-server and web model containing static and dynamic resources.  Can load and performance test many different server types:  Web - HTTP, HTTPS  SOAP / REST  FTP  Database via JDBC  LDAP  Message-oriented middleware (MOM) via JMS  Mail - SMTP(S), POP3(S) and IMAP(S)  MongoDB (NoSQL)  Native commands or shell scripts  TCP
    22. 22. Installing Jmeter 22www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Install Java 7 or higher  Download Jmeter  Add JAVA_HOME environment variable.  Add JAVA_HOME/bin in Path.  Add JMETER_HOME environment variable.
    23. 23. Setting up Environment 23www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Jmeter have simple environment:
    24. 24. Configure JMeter 24www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts To customize JMeter default values, need to edit the properties files. There are three type of files to edit properties: jmeter.properties • Results Config • remote_hosts • not_in_menu user.properties • search_paths • user.classpath system.properties • SSL settings • Key stores • Certificates
    25. 25. Chapter 3 25www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Recording & Playback First Test
    26. 26. What’s Inside 26www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts 3.1 - Concept of Recording & Playback 3.2 - Recording with Badboy 3.3 - Configuring the JMeter HTTP(S)Test Script Recorder 3.4 - Setting up your browser to use the proxy server 3.5 - Case Study 3.6 - Record First Scenario 3.7 - Running First Scenario in GUI Mode 3.8 - Running First Scenario in Non GUI Mode
    27. 27. Concept of Recording & Playback 27www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Jmeter can act as a proxy server between your browser and the web recording your actions.  This can help in writing your web tests. – HTTP(S) Test Script Recorder – Script Recoding Tool (Badboy, Blazemeter)
    28. 28. Recording with Badboy 28www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  A solution for web developers and testers to capture & replay.  Lots of features including a simple yet comprehensive capture/replay interface, powerful load testing support, detailed reports, graphs and much more!  Download Badboy: http://www.badboy.com.au/
    29. 29. Configuring the JMeter HTTP(S) Test Script Recorder 29www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Start JMeter. Add Test Plan | Thread Group | Recording Controller. Right-click on WorkBench and navigate to Add | Non-Test Elements | HTTP(S) Test Script Recorder Enter port to 9099. Under the Test plan content section, choose the option Test Plan > Thread Group from the Target Controller drop-down. Under the Test plan content section, choose the option Put each group in a new transaction controller from the Grouping drop-down. Click on Add suggested Excludes (under URL Patterns to Exclude).
    30. 30. Setting up your browser to use the proxy server 30www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Open Mozilla Firefox. Click on Network and Internet. Click on Tools >> Options >> Advanced >> Network >> Settings. Click on the Manual proxy configuration radio button. In the proxy Address box, enter localhost in the IP address. In the Port number text box, enter 9099. Select the checkbox "Use this proxy server for all protocols".
    31. 31. Case Study 31www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Jmeter4u  OfBiz  Magento  Case 1:  Load of 5 users accessing the server.  Navigating to Home Page -> About Us Page  Generate Report  Case 2:  Load of 50 users browsing the Ecommerce Website (Ofbiz).  Navigating to Home Page -> Category Page -> Product Page -> Add to Cart -> Checkout  Generate Report
    32. 32. Record First Scenario 32www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Start the HTTP(S) Test Script Recorder by clicking on the Start button. In browser, enter http://www.jmeter4u.com/. Click on the ‘Home Page’ Click on the ‘About Me’ Stop the HTTP(S) Test Script Recorder by clicking on the Stop button.
    33. 33. Running First Scenario in GUI Mode 33www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Click on Thread Group. Under Thread Properties set the values as follows: Number of Threads (users): 10 Ramp-Up Period (in seconds): 15 Loop Count: 30 Add Listener on Test Plan and navigate to Add | Listener | View Results Tree. Add Listener on Test Plan and navigate to Add | Listener | Summary Report.
    34. 34. Running First Scenario in Non-GUI Mode 34www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Open command prompt. Navigate to JMETER_HOME/bin folder (Scripts needs to be here) jmeter –n –t jmeter4u.jmx –l log.jtl jmeter -Jusers=5 -n -t jmeter4u-non.jmx -l log2.jtl Once test is over then open jmeter GUI and add any listener i.e Summary Report Import generated jtl file to see results.
    35. 35. Chapter 4 35www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Introduction to Elements of Jmeter Test Plan
    36. 36. What’s Inside 36www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts 4.1 - First Look at Apache Jmeter GUI 4.2 - Test Plan 4.3 - Workbench 4.4 - Thread Group 4.5 - Samplers 4.6 - Logic Controllers 4.7 - Pre-Processor Elements 4.8 - Post-Processor Elements 4.9 - Timers 4.10 - Assertions 4.11 - Configuration Elements 4.12 - Listeners 4.13 - Execution Order 4.14 - Scoping Rules
    37. 37. First Look at Apache Jmeter GUI 37www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Open Jmeter by %JMETER_HOME%/bin/jmeter.bat  Isn't Jmeter GUI looks clear and simple?
    38. 38. Test Plan 38www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Test plan node is where REAL stuff is kept.  Used for containing the test.  A layout of how and what to test.  Describe series of steps JMeter will execute once the test plan runs.  A test plan must have at least one Thread Group.
    39. 39. Workbench 39www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Provides a place to temporarily store test elements while not in use.  For copy/paste purposes or any other purpose you desire.  By default workbench items are not saved, unless you check "Save Workbench" option.  Your WorkBench can be saved independently. Work Bench HTTP Mirror Server HTTP(S) Test Script Recorder Property Display
    40. 40. Thread Group 40www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Thread Group is used for representing users.  There could be one or more Thread Groups in a Test Plan.  Each thread group will execute completely independently from each other.  Thread Group can control:  Number of users simulated (No. of threads).  Ramp Up time (how long it takes to start all the threads).  Number of times to perform the test.
    41. 41. Logic Controller 41www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  These allow you to customize the logic that JMeter uses to decide when to send requests.  The following list consists of all the Logic Controllers JMeter provides: Logic Controller Recording Controller Simple Controller Loop Controller Transaction Controller Random Controller Random Order Controller Run Time Controller Interleave Controller If Controller While Controller Module Controller Throughput Controller
    42. 42. Samplers 42www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Used for performing actual task.  It allow JMeter to send specific types of requests to a server.  The following is a list of all Samplers JMeter provides: Sampler HTTP Request FTP Request JDBC Request SOAP/XML-RPC request SMTP Sampler Debug Sampler
    43. 43. Pre-Processor Elements 43www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  They Execute prior to sampler request.  It's used to modify the settings of a Sample Request just before it runs.  The following list consists of all the Pre-Processor Elements JMeter provides: Pre- Processor HTML Link Parser HTTP URL Re-writing Modifier User Parameters Bean Shell PreProcessor
    44. 44. Post-Processor Elements 44www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  They Execute some action after sampler request.  It's execute after a request has been made from a Sampler.  The following list consists of all the Post-Processor Elements JMeter provides: Post- Processor Regular Expression Extractor XPath Extractor Result Status Action Handler Bean Shell PostProcessor
    45. 45. Timers 45www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Allow JMeter to delay between each request that a thread makes.  Think Time is used for emulating real-life visitors/users.  The following list consists of all the Timers JMeter provides: Timers Constant Timer Uniform Random Timer Gaussian Random Timer Synchronizing Timer Constant Throughput Timer Poisson Timer
    46. 46. Assertions 46www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Used for Validating Test.  Allow you to "test" that your application is returning the results you expect it to.  The following list consists of all the Assertions JMeter provides: Assertion Response Assertion Duration Assertion Size Assertion HTML Assertion XPath Assertion
    47. 47. Configuration Elements 47www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  They are used to add or modify requests made by Samplers.  They Works closely with a Sampler, these can add to or modify requests.  The following list consists of all the Configuration Elements JMeter provides: Configuration Element HTTP Request Defaults FTP Request Defaults CSV Data Set Config HTTP Authorization Manager HTTP Cookie Manager HTTP Cache Manager JDBC Connection Configuration
    48. 48. Listeners 48www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Listeners are used for displaying of data.  Listeners provide means to view, save, and read saved test results.  The following list consists of all the Listeners JMeter provides: Listeners View Results Tree Summary Report Aggregate Report Assertion Results View Results in Table Simple Data Writer Save Responses to a file External Plugin (Jmeter PerfMon)
    49. 49. Execution Order 49www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  JMeter execute test in below order: o Configuration Elements o Pre-Processors o Timers o Sampler o Post-Processors o Assertions o Listeners  Timers, Assertions, Pre- and Post-Processors are only processed if there is a sampler to which they apply.  Logic Controllers and Samplers are processed in the order in which they appear in the tree.
    50. 50. Scoping Rule 50www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  JMeter test tree contains elements that are both hierarchical and ordered.  Strictly hierarchical (Config Elements, Pre-Processors, Timers, Post- Processor, Assertions, Listeners)  Primarily ordered (controllers, samplers). The order of requests will be, One, Two, Three, Four. Assertion #1 is applied only to Request One, while Assertion #2 is applied to Requests Two and Three. Timer #1 will apply to Requests Two, Three, and Four (notice how order is irrelevant for hierarchical elements). Assertion #1 will apply only to Request Three. Timer #2 will affect all the requests.
    51. 51. Chapter 5 51www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Load/Performance Testing of Websites
    52. 52. What’s Inside 52www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts 5.1 - Preparing for Load Testing 5.2 - Need to Know 5.3 - Some Helpful Tips to Get Better Results 5.4 - Using Jmeter Components 5.5 - Workload Modeling 5.6 - Phases of Workload Modeling 5.7 - Workload Modeling - Case Study 5.8 - Running theTest Plan 5.9 - Interpreting the Results 5.10 - Monitoring the Server's Performance 5.11 - Performance Test Reporting
    53. 53. Preparing for Load Testing 53www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Need to address a number of concerns with regards to the target server under test.  A load testing helps to benchmark performance behavior of a server, it is important to be able to identify the general expectations and other matters that would normally be taken into account in order to carry out a successful load testing.
    54. 54. Need to Know 54www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  A suitable time to load-test the application, for instance when no development work is taking place on the server and/or no other users are accessing the server.  The performance metrics, accepted levels, or SLAs and goals.  Objectives of the test.  The Internet protocol(s) the application is (are) using (HTTPS, HTTP, FTP, etc.)  If your application has a state, the method used to manage it (URL rewriting, cookies, etc.)  The workload at normal time and at peak time.
    55. 55. Some Helpful Tips to Get Better Results 55www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Use meaningful test scenarios to construct 'real-life' test cases.  Run JMeter on a machine other than that running the application.  The machine running JMeter should have sufficient network bandwidth, memory, CPU to generate load.  Let JMeter Test Plan run for long time periods, hours or days, or for a large number of iterations.  Ensure that the application is stable and optimized for one user before testing it for concurrent users.  Incorporate 'thinking time' or delays using Timers in your JMeter Test Plan.  Keep a close watch on the four main things: processor, memory, disk, and network.
    56. 56. Using Jmeter Components 56www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  We will test five key scenarios:-  Homepage  Login  Search Item  Select Item  Checkout These scenarios will be included in a single JMeter Test Plan, for simplicity reasons.
    57. 57. Workload Modeling 57www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Load distribution across all the identified scenarios of AUT is called the Workload.  Workload model of an application depicts how this application will be used in the production environment.  Workload modeling can be divided into:  Business Workload: Set of user actions or business scenarios performed within the test to achieve the business objectives and goals is called the business workload.  Infrastructure Workload: The amount of resources/infrastructure used by the business scenarios to achieve their desired goals is called the Infrastructure workload.  Importance of Workload Modeling  Performance Scenarios Identification  Performance Test SLAs  Test Data Preparation  Required Number of Load Injectors
    58. 58. Phases of Workload Modeling 58www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Workload Design Miscellaneous Options Identify Target Load Levels Relative Load Distribution Identify Unique Test Data Navigation Paths of Key Scenarios Key Scenarios Identification Application Understanding Test Objectives Identification
    59. 59. Workload Modeling- Case Study 59www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Workload Model User Scenarios Percentage of work distribution Active Users= 500 Home Page 40 200 Login 15 75 Search Item 15 75 Select Item 20 100 Checkout 10 50
    60. 60. Run Test Plan 60www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  When Jmeter script gets ready.  Click on “Start”.
    61. 61. Interpreting the Results 61www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Summary Report  Aggregate Report  Assertion Result  View Result Tree
    62. 62. Monitoring the Server's Performance 62www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  There is a special Listener that allows you to monitor the target server's performance as Samplers make requests.  Some server monitoring tools:  PerfMon  Blazemeter  Loadosophia
    63. 63. Performance Test Reporting 63www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Introduction  Test Environment (Software and Hardware)  Goals of this Report  Assumptions  Performance requirements  Workload Scenario  Performance Testing Approach  Results  Samples Response Monitoring (Jmeter results) o Run Date: 6/01/2014 o Duration: 1 hour, 38 minutes, 30 seconds o High Load Count: 2 users every 300 seconds (varies) o Ramp-up Increment: 35 users o Think Time: varies o Connection Speed: Broadband
    64. 64. Chapter 6 64www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Handling the dynamic server values
    65. 65. What’s Inside 65www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts 6.1 - What is Correlation 6.2 - Regular Expression 6.3 – Meta Characters for RegEx 6.4 - Managing session with Regular Expression Extractor 6.5 - Managing sessions with cookies 6.6 - Managing sessions with URL rewriting
    66. 66. What is Correlation 66www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  A Correlation is a Connection or Association.  Capturing the dynamic data that is being generated by the server is called correlation.  Correlation will be done using the Regular Expression Extractor in Jmeter. Reason to Correlation: To overcome script fail we need a way which can capture these dynamically generated session values and pass it subsequently to any part of the script, wherever required. This method to identify and set the dynamic generated value is known as correlation.
    67. 67. Regular Expression 67www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Extract single string o Suppose you want to match the following portion of a web-page: o name="file" value="readme.txt"> o And you want to extract readme.txt . o A suitable regular expression would be: o name="file" value="(.+?)"> o The special characters above are: o ( and ) - enclose the portion of the match string to be returned o . - match any character o + - one or more times o ? - don't be greedy, i.e. stop when first match succeeds
    68. 68. Meta Characters for RegEx 68www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Regular expressions use certain characters as meta characters - these characters have a special meaning to the RE engine. Such characters must be escaped by preceding them with (backslash) in order to treat them as ordinary characters.  List of the meta characters and their meaning: Meta Character Definition ( and ) Grouping [ and ] Character classes { and } Repetition *, + and ? Repetition . Wild-Card Character Escape Character | Alternatives ^ and $ Start and End of string or line
    69. 69. Managing session with Regular Expression Extractor 69www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Name Regular Expression Extractor : jsessionid.  Reference Name : jsessionid  Enter Regular Expression : jsessionid = "(.+?)" /> o (.+?) this refers JMeter captures any values in between LB and RB)  Template : $1$ (this is for grouping)  Match No : 1  Default Value : NONE (To pass default value enter string here)
    70. 70. Managing sessions with cookies 70www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  A majority of web applications rely on cookies to maintain the session state. It's used to store a lot more information, such as user IDs and location preferences.  Start JMeter.  Navigate to Test Plan | Thread Group | Recording Controller  Add Test Script Recorder to Workbench.  In the browser, go to http://demo-old-ofbiz.apache.org/ecommerce/.  Click on Login tab.  Enter admin in the Username field & ofbiz in the Password field.  Click on Login & Logout.  Add Cookie Manager from Config Element.  Save the test plan.
    71. 71. Managing sessions with URL rewriting 71www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  When session ID is attached to all URLs then technique used known as URL rewriting.  This ensures that the session ID is automatically sent back to the server as part of the request, without the need of putting it in the header.  The advantage of this technique is that it works even if a client browser has cookies disabled.  Start JMeter.  Navigate to Test Plan | Thread Group | Recording Controller  Add Test Script Recorder to Workbench.  In the browser, go to http://demo-old-ofbiz.apache.org/ecommerce/.  Click on Login tab.  Enter admin in the Username field & ofbiz in the Password field.  Click on Login & Logout.  Add “HTTP URL Re-writing Modifier” and check ‘Path Extension’ & ‘Cache Session Id’.  Clean up test plan is the already existing session IDs that were captured during our recording.  Save the test plan.
    72. 72. Chapter 7 72www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Parameterize with test data
    73. 73. What’s Inside 73www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts 7.1 - What is Parameterization 7.2 - Why Parameterize 7.3 - Identifying the test data on AUT 7.4 - Using the CSV Data Config in JmeterTests
    74. 74. What is Parameterization 74www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  It is the way of replacing a hard coded value in the script with a parameter which represents a list of values.  It is a script that contains the actual values used during recording and during script enhancement phase test engineer has to replace the recorded values with parameters is known as parameterizing the script.
    75. 75. Why Parameterize 75www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  It allows you to test your script with different values.  Replace the constant values in Script with parameters.  Simulate real user behavior while running the test.
    76. 76. Identifying the test data on AUT 76www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  While login “Username” & “Password” are parameter for which test data needed.  While registration “First Name”, “City” etc. is parameter for which test data needed.
    77. 77. Using the CSV Data Config in Jmeter Tests 77www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Create CSV file with list of username and password.  Store in same folder where your test stores.  Add CSV Data set into your test tree from config elements.  Add ${username},${password} in request sampler as parameter.
    78. 78. Chapter 8 78www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Project Case Study
    79. 79. What’s Inside 79www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts 8.1 - Goals of PerformanceTest 8.2 - PerformanceTest Approach 8.3 - Test Design 8.4 - Test Preparation 8.5 - Test Run 8.6 - Test Results 8.7 - Conclusion
    80. 80. Goals of Performance Test 80www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  The objectives are derived from the customer request to compare user experience under anticipated production workload against new production environment.  To verify response times and stability of the system under increasing user loads.  To identify potential performance problems and provide recommendations to address potentials problems.
    81. 81. Performance Test Approach 81www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Defining workload models for application: Workload Model Test Scenarios Percentage of Load distribution Active Users= 100 Active Users= 200 Active Users= 300 Home Page 40 % 40 80 120 Login_Browse 15 % 15 30 45 Search_Select_Item 15 % 15 30 45 Registration 20 % 20 40 60 Checkout 10 % 10 20 30
    82. 82. Test Design 82www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Designing test cases for workload model 1: Test Plan Thread Group Thread Properties Transaction Test Plan: Workload_01 TG: Home_Page No. of Thread = 40 Ramp up =10 Loop = 3 1. Navigate to Home Page. TG: Login_Browse No. of Thread = 15 Ramp up =5 Loop = 3 1. Navigate to Home Page. 2. Click on Login Page. 3. Enter Login Details & Submit. 4. Browse the Items. 5. Logout TG: Search_Select_Item No. of Thread = 15 Ramp up =5 Loop = 3 1. Navigate to Home Page. 2. In search bar, enter ‘Tiny Gizmos’. 3. Click on Search. 4. Select the Item. TG: Registration No. of Thread = 20 Ramp up =5 Loop = 3 1. Navigate to Home Page. 2. Click on Register. 3. Fill all required details 4. Click on Register. TG: Checkout No. of Thread = 10 Ramp up =5 Loop = 3 1. Navigate to Home Page. 2. Click on Login Page. 3. Enter Login Details & Submit. 4. Select the Item. 5. Add to cart 6. Proceed to checkout 7. Order confirmation 8. Logout
    83. 83. Test Preparation 83www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Test Data • Registered user should be created. • Item with categories should be present.  Jmeter Script • Record using HTTP proxy server • Create test plan as per workload design • Apply proper Assertions, timers and Listeners.  Server Monitoring & Logging • To get better graphs install PerfMon plugin on each server. • Application & MySQL server logs should be enabled.  Dry Runs • Test to make sure all test execution issues are surfaced and resolved.
    84. 84. Test Run 84www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  All team are informed before test execution starts. And all activates during execution are monitored and logged for post execution analysis.  Run Baseline test before actual load testing.  Run workload model and monitor the server while test in execution.  Keep wait time before going for another test cycle.  Restore the Application & Database for another cycle.
    85. 85. Test Results 85www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Goal of analysis are: • Load/Stress • Tuning/Optimization • Resource utilizations  Real Rime Analysis • Response times • CPU, DISK, MEMORY, NETWORK Post Execution Analysis • Vuser • Response Time • Throughput • Resource Utilization
    86. 86. Conclusion 86www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Once test run on both old production and new production environment then observation should be reported to management and action needs to taken on it.
    87. 87. Chapter 9 87www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Best Practices
    88. 88. What’s Inside 88www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts 9.1 - Tips to scale Jmeter Usage 9.2 – Client Side PerformanceTestingTools 9.3 - Jmeter Functions 9.4 - Debugging with Debug Sampler
    89. 89. Tips to scale Jmeter Usage 89www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  A machine with 4GB RAM and a quad-core 2.4 GHz processor, running JMeter with 1GB of heap, can usually run 250-300 users.  Do not use GUI mode better use non-GUI mode.  Use Remote and Distributed testing for larger load testing.  Use naming conventions for all the elements.  Don't use "View Results Tree" or "View Results in Table" listeners during the load test; use them only during scripting phase to debug your scripts.  Only save the data that you need.  Use as few Assertions as possible.  Use timers in your scripts.  Use as few Listeners as possible.  Understand the application requirements and the test target goals.  Keep a profiler and monitoring tools close at hand.
    90. 90. Client Side Performance Tools 90www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Some methods of client side performance testing in order to make your users happier with responsive web sites.  Yslow  Pagespeed  Gtmetrix (My Personal Favourite)  HTTPFox  Httpwatch  Webpagetest  Pingdom
    91. 91. Jmeter Functions 91www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  JMeter functions are special values that can populate fields of any Sampler.  A function call looks like this: ${__functionName(var1,var2,var3)}
    92. 92. Debugging with Debug Sampler 92www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Debug Sampler generates a sample containing the values of all JMeter variables and/or properties.  Debug Sampler” has three options: • JMeter properties • JMeter variables • System properties  Prints sampler properties which will be useful to find the actual problem in the sampler. Debug PostProcessor  Debug PostProcessor creates a subSample with the details of the previous Sampler properties, JMeter variables, properties and/or System Properties.
    93. 93. Chapter 10 93www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Advanced Features
    94. 94. What’s Inside 94www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts 10.1 - Testing SOAPWeb Services 10.2 - Testing RESTWeb Services 10.3 - Testing a Database Server 10.4 - Testing an FTP Server
    95. 95. Testing SOAP Web Services 95www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  SOAP is a protocol specification to exchange information between network systems.  Communication and negotiation between systems is done by passing XML message formats over a variety of transport protocols, including HTTP, JMS, Mail, VFS, and so on.  SOAP is a protocol and is governed by standards whereas REST is an architectural style.  Due to SOAP's characteristics (extensibility, neutrality, and independence),its used to communicate effectively without needing to be on the same platform or in the same programming language.  JMeter offers two components:  SOAP/XML-RPC Request  HTTP Request
    96. 96. Testing SOAP Web Services 96www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Start JMeter.  Add Test Plan | Thread Group | Add Sampler | SOAP/XML-RPC Request.  Enter following details in SOAP/XML-RPC Request:  URL: http://wsf.cdyne.com/WeatherWS/Weather.asmx  Send SOAPAction: http://ws.cdyne.com/WeatherWS/GetCityWeatherByZIP  SOAP/XML-RPC Data: This is given by the following code snippet: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/ soap/envelope/" xmlns:weat="http://ws.cdyne.com/WeatherWS/"> <soapenv:Header/> <soapenv:Body> <weat:GetCityWeatherByZIP> <weat:ZIP>${__Random(60601,60610)}</weat:ZIP> </weat:GetCityWeatherByZIP> </soapenv:Body> </soapenv:Envelope>  Make sure the checkbox for Send SOAPAction is checked.  Navigating to Test Plan | Add| Listener | View Results Tree.  Save test plan.
    97. 97. Testing SOAP Web Services 97www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Start JMeter.  Add Test Plan | Thread Group | Add Sampler | Http Request.  Enter following details in Http Request:  Server Name or IP: wsf.cdyne.com  ‰‰Method: POST  ‰‰Path: /WeatherWS/Weather.asmx  Body Data: This is given by the following code snippet: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/ soap/envelope/" xmlns:weat="http://ws.cdyne.com/WeatherWS/"> <soapenv:Header/> <soapenv:Body> <weat:GetCityWeatherByZIP> <weat:ZIP>${__Random(60601,60610)}</weat:ZIP> </weat:GetCityWeatherByZIP> </soapenv:Body> </soapenv:Envelope>  Add HTTP Header Manager as a child of HTTP Request | Add Config Element | HTTP Header Manager.  Navigating to Test Plan | Add| Listener | View Results Tree.  Save test plan. Name Value Content-Type text/xml SOAPAction http://ws.cdyne.com/WeatherWS/GetCityWeatherByZIP
    98. 98. Testing REST Web Services 98www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Representational State Transfer (REST) is the most widely used model for web service implementation.  REST is a simple stateless architecture that uses HTTP protocol.  It is lightweight, not strongly typed and unlike SOAP isn't bound to only XML format.  REST web services adhere to the principles of REST and rely on the following HTTP methods:  GET is used to list or retrieve resource(s)  PUT is used to replace or update resource(s)  POST is used to create a new resource  DELETE is used to delete resource(s)  In a Client-Server Application most of the web services use REST API so that clients, third party applications can access its resources using URI.
    99. 99. Testing REST Web Services 99www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Start JMeter.  Navigating to Thread Group | Add | Config Element | HTTP Request Default  Server Name or IP: api-jcb.herokuapp.com  HTTP Header Manager component by navigating to Thread Group | Add | Config Element | HTTP Header Manager.  ‰‰Name: Content-Type  ‰‰Value: application/json  Navigating to Thread Group | Add | Sampler | Add HTTP Request. Update the following details:  ‰‰Name: Get All Requests  ‰‰Path: /holiday-requests
    100. 100. Testing REST Web Services 10 0 www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Navigating to Thread Group | Add | Sampler | Add HTTP Request. Update the following details:  ‰‰Name: Create Holiday Request  ‰‰Path: /holiday-requests  Method: POST  ‰‰Body Data: This is given by the following code snippet: { "employeeId": 688, "employeeName": "Stephen Lee", "startDate": "2014-07-01T00:00:00Z", "endDate": "2014-07-08T00:00:00Z" }  Navigating to Thread Group | Add | Sampler | HTTP Request. Fill in the following details:  ‰‰‰Name: Delete Holiday  ‰‰Path: /holiday-requests/${id}  ‰‰Method: DELETE  Navigating to Test Plan | Add| Listener | View Results Tree.  Save test plan.
    101. 101. Testing FTP Server 10 1 www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  File Transfer Protocol (FTP) is a standard network protocol used to transfer files between hosts over the Internet.  Applications will normally use it as a means of uploading or downloading files to/from different hosts.  FTP was not designed as a secure protocol, and as a result has several security vulnerabilities, the biggest being unencrypted traffic, which allows eavesdropping.  Because of security aspect, it is not desirable to use FTP in its standard form.  SFTP is secure FTP, allowing all FTP communication to be secure over Secure Shell (SSH).
    102. 102. Testing FTP Server 10 2 www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Start JMeter.  Add Test Plan | Thread Group | Add Sampler | FTP Request.  Enter following details in this element:  Name − FTP Request Get  Server Name or IP − demo.ftp.server  Remote File − /home/download/sample.txt  Local File − sample.txt  Select get(RETR)  Username − demo123  Password − demo123  Navigating to Test Plan | Add| Listener | View Results Tree.  Save test plan.
    103. 103. Testing Database Server 10 3 www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Database is backbone of any application as data is converted to graphical user interface (GUI) by a middleware to the end user.  Database need to check outside the application as it helps to identify database bottlenecks such as expensive table joins, missing table indexes, slow running queries, and so on.  Prerequisites for building a Database Test Plan are:  A working database driver, copy the .jar file contained in the database driver and pastes it in the lib folder of your JMeter.  A valid database-schema.  Valid non-empty database table(s).  A valid user-level access to the database.
    104. 104. Testing Database Server 10 4 www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Start JMeter.  Add Test Plan | Thread Group | Config Element > JDBC Connection Configuration.  Enter following details in this element:  Variable Name: Var 1  Database URL − jdbc:mysql://localhost:3306/tutorial  JDBC Driver class: com.mysql.jdbc.Driver  Username: root  Password: admin  Navigating to Test Plan | Thread Group | Sampler | Add JDBC Request.  Variable Name: Var 1  Name − Sample Test  Enter the Pool Name − Var 1  Query Type − Select statement.  Enter the SQL Query String field "Select col from table"  Navigating to Test Plan | Add| Listener | View Results Tree.  Save test plan.
    105. 105. Chapter 11 105www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Extend Jmeter
    106. 106. What’s Inside 106www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts 11.1 - Distributed Testing 11.2 - Sever Monitoring Tools (PerfMon) 11.3 - Database Monitoring Tool (Jet Profiler) 11.4 - Integration Selenium with Jmeter 11.5 - Integration test with Maven & Jmeter 11.6 - Continuous Integration with Maven & Jmeter 11.7 - Integration test with Ant & Jmeter 11.8 - Continuous Integration with Ant & Jmeter 11.9 - Testing with different Bandwidths 11.10 - Performance Testing using Cloud basedTools (Blazemeter, Floodio, OctoPerf) 11.11 - Jmeter BeanShell
    107. 107. Distributed Testing 107www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Distributed testing is a kind of testing which use multiple systems to perform stress testing.  Master: The system running Jmeter GUI which control the test.  Slave: The System running Jmeter- server which takes commends from the GUI and send the requests to the target system.  Target: The Web Server planned for the load test.
    108. 108. Server Monitoring Tools (PerfMon) 108www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  JMeter Plugins at Google Code (JP@GC) is a popular third-party plugins set for JMeter.  The project provides additional samplers, graphs, listeners, and so on, all of which make it more fun to work with JMeter.  Basically, the JP@GC set contains two types of plugins: graph plugins and JMeter functionality extensions.  Installation: 1. Go to the download section of http://jmeter-plugins.org/. 2. Download the JMeterPlugins-Standard-1.2.1.zip (JMeter custom plugins). 3. Download the ServerAgent-2.2.1.zip (Server resource monitoring agents). 4. Extract & paste the JMeterPlugins-Standard-1.2.1.zip file into lib/ext folder under JMeter installation path. 5. Extract & paste the contents of the ServerAgent-2.2.1.zip file somewhere on the server. 6. Launch the agent using startAgent.sh script on Unix, or startAgent.bat script on Windows and the agent will be started on port 4444.
    109. 109. Server Monitoring Tools (Graph Plugins) 109www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts 1. Launch JMeter. 2. Open the test plan 3. Add a PerfMon Metrics Collector listener by navigating to Test Plan | Add | Listener |jp@gc – PerfMon Metrics Collector  Add one row each to gather these metrics (CPU, Memory, Network I/O, Disks I/O)  Host/IP: localhost  Port: 4444  Metrics to collect (dropdown): CPU/Memory/Network I/O, Disks I/O 4. Add a response time vs threads listener by navigating to Test Plan | Add | Listener |jp@gc – Response Times over Time. 5. Add a Transactions per second listener by navigating to Test Plan | Add | Listener |jp@gc – Transactions per Second. 6. Save the test plan.
    110. 110. Server Monitoring Tools (Functionality Extensions) 110www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts 1. jp@gc - Stepping Thread Group 2. jp@gc - Ultimate Thread Group 3. jp@gc - Throughput Shaping Timer 4. BM.Sense Uploader
    111. 111. Database Monitoring Tool (Jet Profiler) 111www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Jet Profiler for MySQL is a query profiling tool for the MySQL database server.  Query, table and user performance  Graphical Visualization  Low overhead  User friendly  Detail Link: http://www.jetprofiler.com/
    112. 112. Integrating selenium with Jmeter 112www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  JMeter can be used to record browser actions using proxy, but since JMeter doesn’t handle JavaScript, it cannot be used on its own to simulate realistic user interaction with a JavaScript/Ajax heavy web application.  Selenium can be used to record user-interaction with a web application where lots of interactions happen using Ajax.  It’s simple to integrate Selenium with JMeter.  Approach:  Selenium WebDriver with Eclipse and then run selenium test script in Jmeter.  Using "Web Driver Sampler" from JMeterPlugins-WebDriver.  Details Approach on below link: http://www.jmeter4u.com/2015/06/integrating-selenium-with-jmeter-for.html
    113. 113. Integration test with Maven & Jmeter 113www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Maven is a build automation tool and project configuration tool.  Based on the concept of POM (Project Object Model) to manage build, reporting & documentation from central piece of information.  POM is an XML contain information about project & configuration to build project.  Installation & Setup: o Download Maven & Unzip. o Set environment variables & path for Java & Maven. o Verify maven installation using cmd, type mvn -version Objective:  To run my Jmeter tests in a specific maven phase and create the relevant Jmeter test results html reports and publish them. • Create a simple maven project • Add the JMeter Maven plugin • Create a JMeter test • Run it in Maven
    114. 114. Continuous Integration with Maven & Jmeter 114www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Pre-requisites: • Download Jenkins "jenkins.war" • Install Jenkins by running command java -jar jenkins.war under root folder. • Get Jenkins running. • Configure the Java, Maven path using Manage Jenkins link. • Install plugin (Performance Plugin, Maven Plugin, Git Plugin) using Manage Jenkins link.  Create Jenkins job: • Navigate to http://localhost:8080/. • Click New Job & create a maven job • Under source code management chose Git. • Set the repository URL to https://github.com/jmeter4u/jmeter-jenkins.git • Add a Maven build step with “verify” as the goal. • Down in Post-build Actions check the Publish Performance test result report checkbox. • Click the Add a new report box and choose JMeter • For Report files specify **/*.jtl • Also under Post-build Actions check the Archive the artifacts checkbox. • Click Save & Build Now.
    115. 115. Integration test with Ant & Jmeter 115www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  ANT stands for Another Neat Tool. It is a Java-based build tool from Apache.  ANT to automate the build and deployment process in simple and easy steps.  Need for a Build Tool: • Compiling the code • Packaging the binaries • Deploying the binaries to the test server • Testing the changes  Installation & Setup: o Download Ant & Unzip. o Set environment variables & path for Java & Ant. o Verify ant installation using cmd, type ant -version Objective:  To automate JMeter test plans using Ant. The Ant task executes one or more JMeter test plans, and logs the results to a file. • Create ANT-JMeter Project: • Use existing build.xml and customize accordingly. • Now run targets in existing file.
    116. 116. Continuous Integration with Ant & Jmeter 116www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Create Jenkins Job: Create a simple free style project.  Invoke JMeter Test from Jenkins  Jenkins-Performance Plugin  Emailing the Results  Summary
    117. 117. Testing with different bandwidths 117www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Bandwidth can be critical to the performance of a website. Now question is how it will perform on different network speeds.  JMeter provides a way to simulate various network bandwidths, where application under test will react under various network conditions.  It’s important as user can connect from any device or network.  Open $JMETER_HOME/bin/jmeter.properties.  Add the following properties to user properties.  This specifies a mobile data GPRS: 171 Kbps bandwidth. Refer to the following parameters:  ‰‰httpclient.socket.http.cps=21888  ‰‰httpclient.socket.https.cps=21888  This specifies a Wi-Fi 802.11a/g: 54 Mbps bandwidth. Refer to the following parameters:  ‰httpclient.socket.http.cps=6912000  ‰‰httpclient.socket.https.cps=6912000  Save & Launch Jmeter  Run the test and observe values reported in the KB/sec column in the Aggregate Report listener. cps = (target bandwidth in kbps * 1024) / 8
    118. 118. Performance Testing of applications using BlazeMeter 118www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  BlazeMeter is a commercial, self-service load testing platform-as-a-service (PaaS), which is fully compatible with open-source Apache JMeter.  BlazeMeter offers elastic performance testing Cloud. 1. Create a BlazeMeter account at http://blazemeter.com/ 2. Log in to your account. 3. Click on the “create test” on the top navigation bar. 4. Click on the Upload Files button and upload the sample.jmx file. 5. Change the Rampup setting to 30 seconds. 6. Change the Duration setting to 10 minutes. 7. Change the JMeter version to 2.13. 8. Save the test. 9. Run Test. 10. Wait for the test to finish and observe the detailed reports.
    119. 119. Performance Testing of applications using Floodio 119www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Flood.io is a paid service.  The free user account gives you a monthly quota of an hour and allows you to run your tests for a maximum of five minutes after which it is shut-down.  Check it out floodio cloud service: 1. Create a free account at http://flood.io 2. Sign-in to your account. 3. Once logged in, click on the Create Flood button. 4. Upload the jmeter script (jmeter4u.jmx). 5. Provide a name for your flood. 6. Select the only available grid on the free tier. 7. Optionally, you can enter the number of threads, ramp up, and duration into their respective boxes, but for our purposes, you can skip them. 8. Click on the Start Flood button.
    120. 120. Performance Testing of applications using OctoPerf 120www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  OctoPerf is realistic and accessible performance testing. Validate your website speed under load in just a few clicks. Sign up and get a lifetime free account to test!  Check it out OctoPerf cloud service: 1. Navigate to https://octoperf.com/ 2. Click on free account. It will take you to dashboard. 3. Create a "New Project" 4. Now Create Virtual User script by import the jmeter script (jmeter4u.jmx). 5. Click on Create Scenario to modify Thread group properties. 6. Click on Launch VUs. 7. Wait for test to complete. And Click on Export to View & Save Results.
    121. 121. Jmeter BeanShell 121www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  BeanShell is a java like scripting language.  It in some way is an extension to the mainstream Java language by providing scripting capabilities.  BeanShell aids in quick development and test of Java application.  BeanShell can also be used as a configuration language as it supports creation of Java based variables like strings, arrays, maps, collections and objects.  JMeter provides the following components that can be used to write BeanShell scripts: 1. BeanShell Sampler 2. BeanShell PreProcessor 3. BeanShell PostProcessor 4. BeanShell Assertion 5. BeanShell Listener 6. BeanShell Timer
    122. 122. Jmeter BeanShell 122www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  The following table shows some of the common variables used by the BeanShell components:  Conclusion • BeanShell scripting language provides scripting capabilities to the Java language. • In JMeter, you can use different BeanShell components to write the test scripts and execute the same. • Each component is equipped with useful variables that can be used in the scripts to perform the control flow. • The scripting feature adds a powerful and useful dimension to the JMeter testing tool. • The objective of the article was to show the usage of common Beanshell components and how one can write test scripts to execute test. Variable Name Description ctx It holds context information about the current thread that includes sampler and its results. vars This is a thread local set of variables stored in a map used by BeanShell components in the same thread. props These are variables loaded as properties from an external file (jmeter.properties) stored in the classpath. prev It holds the last result from the sampler data It holds server response data
    123. 123. Chapter 12 123www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Supporting Application & Books
    124. 124. What’s Inside 124www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts 12.1 - Setting up Ecommerce Application in Local Machine 12.2 - Setting up Ecommerce Application in AWS 12.3 – Reference Books 12.4 – Job & Discussion Forum
    125. 125. Setting up Ecommerce Application in Local Machine 125www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Pre-requestics Softwares: • Install Java 1.7 or upper version and set the JAVA_HOME in windows environment Variable. • Install Ant1.8 and upper version and set the ANT_HOME in windows environment Variable. Steps to run ofbiz 12.04 (assuming java jdk is installed and set in environment : 1. Extract the ofbiz zip. And navigate to the extracted ofbiz directory using command prompt. 2. Download mysql jdbc driver and place in ${ofbiz install dir}/framework/entity/lib/jdbc 3. Open entityengine: ${ofbiz install dir}/framework/entity/config/entityengine.xml file: • Change the "datasource-name" attribute under the from the default "localderby" to "localmysql" • Change the "jdbc-uri" under "localmysql" to "jdbc:mysql://127.0.0.1/ofbiz?autoReconnect=true" • Change the "jdbc-username" to “root" • Change the "jdbc-password" to “root” 4. After the database setup, now you need to load data, using this initial command: ant load-demo 5. To start the ofbiz using command tools/startofbiz.bat on windows or tools/startofbiz.sh on linux. 6. Once the server is started go to following link http://localhost:8080/ecommerce for demo ecommerce and https://localhost:8443/webtools/control/main for ofbiz backend using credentials admin/ofbiz.
    126. 126. Setting up Ecommerce Application in AWS 126www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Signing Up for free tier account, we need to set up a few security groups and users. This will allow us to access services without using our root AWS account. It only takes a few minutes and will set you up for future use. 1. Launch an Instance 2. Connect to Your Instance 3. Installing Ofbiz Ecommerce Application 4. Clean Up Your Instance  Details on: http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/EC2_GetStarted.html
    127. 127. Reference Books 127www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Performance Testing JMeter Bayo Erinle  JMeter - Cookbook Bayo Erinle  Art Application Performance Testing  Visit www.jmeter4u.com to buy these books. You can find in bottom of the page.
    128. 128. Job & Discussion Forum 128www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts  Jmeter Help Forum: https://groups.google.com/forum/#!forum/jmeterhelp  Performance Testing Jobs: https://groups.google.com/forum/#!forum/performance-testing-jobs  Nabble Jmeter Forum: http://jmeter.512774.n5.nabble.com/  Stack Overflow Jmeter: http://stackoverflow.com/questions/tagged/jmeter
    129. 129. 129www.jmeter4u.com | Email: jmeter4u@gmail.com | Skype: jmeter.experts Thank You

    ×