Performance Load and Stress Testing Introduction to JMeter

  • Slides: 34
Download presentation
Performance, Load and Stress Testing Introduction to JMeter Franz Fischbach Automation QA Software University

Performance, Load and Stress Testing Introduction to JMeter Franz Fischbach Automation QA Software University http: //softuni. bg

Table of Contents (1) 1. Introduction to Performance, Load and Stress testing § Main

Table of Contents (1) 1. Introduction to Performance, Load and Stress testing § Main Concepts Ø Performance testing Ø Load Testing Ø Stress Testing 2

Table of Contents (2) 2. Introduction to JMeter § § Set up and quick

Table of Contents (2) 2. Introduction to JMeter § § Set up and quick overview Ø Elements of a test Plan Ø Execution Order Setting up the recorder Ø Elements of a test plan 3

Table of Contents (3) 3. Let’s learn by doing! Configure Test Environment Ø Record

Table of Contents (3) 3. Let’s learn by doing! Configure Test Environment Ø Record use case scenario Ø Ø Login Ø Customize use case scenario for each user 4. Questions 4

Introduction to Performance, Load and Stress testing Main Concepts

Introduction to Performance, Load and Stress testing Main Concepts

What is Performance/Load/Stress Testing? § They provide stakeholders with information about the quality of

What is Performance/Load/Stress Testing? § They provide stakeholders with information about the quality of the product or service under test § Performance testing, load testing and stress testing are three different non-functional testing techniques that are done for different purposes 6

Performance vs. Load vs. Stress Testing § What can we learn from the different

Performance vs. Load vs. Stress Testing § What can we learn from the different test types? § Performance / Load / Stress tests help us determine or validate the speed, scalability and stability of the system 7

Performance vs. Load vs. Stress Testing What is the difference? § The difference lies

Performance vs. Load vs. Stress Testing What is the difference? § The difference lies in the questions the different test types are supposed to answer § Performance Testing – How fast is the system? § Load Testing – How much load can the system handle? § Stress Testing – Under what conditions will the system fail? 8

Performance vs. Load Testing So what was the difference again? § Another way of

Performance vs. Load Testing So what was the difference again? § Another way of distinguishing between Performance and Load testing is to see if the Load / Performance test is white-box or black-box orientated 9

Performance vs. Load vs. Stress Testing § Performance tests tend to be white box

Performance vs. Load vs. Stress Testing § Performance tests tend to be white box orientated § Usually a whole range of team members are involved in the creation of a performance test. Including QAs, Developers, Database-Administrators in order to tailor the code to work as efficient as possible § How fast can we make the login? 10

Performance vs. Load vs. Stress Testing § A load test tends to be black-box

Performance vs. Load vs. Stress Testing § A load test tends to be black-box orientated § Usually one team member is involved in the creation of a load test § The application is viewed from a user-standpoint § How long does it take to login? 11

Performance Test § Performance tests are usually performed against products that are considered stable

Performance Test § Performance tests are usually performed against products that are considered stable § The goal of performance testing is not to find bugs but to: Ø Determine compliance with performance goals and requirements Ø Establish a baseline for future regression testing Ø Eliminate bottlenecks 12

How to design a performance Test ? 1. 2. 3. 4. 5. 6. 7.

How to design a performance Test ? 1. 2. 3. 4. 5. 6. 7. Choose a Test Environment Identify Performance Acceptance Criteria Plan and Design Tests Configure Test Environments Implement Test Design Execute Tests Analyze, Report, Schedule Retest 13

Load Test What can we do with it? § The goal of load testing

Load Test What can we do with it? § The goal of load testing is usually not to find bugs but to: § Measure the performance characteristics of an application under specific volumes of load § Test cases should consist of the upper and lower use case limits that are determined by the business/use case scenario 14

Goals of Load Testing § Load Testing aims to identify the need of improving

Goals of Load Testing § Load Testing aims to identify the need of improving the applications: § Performance § Do we need to reduce the time needed to execute a request ? § Scalability § Can the system handle the anticipated number of concurrent users during peak load in production? § Stability Does the application suffer from memory leaks when under load for extended periods of time? § Is the application prone to crashes when under load for extended periods of time? § 15

Load Testing Metrics § The best source of information during load tests are: §

Load Testing Metrics § The best source of information during load tests are: § Average Response times § Peak Response times § Error Rates § Throughput § Requests per second § Concurrent Users Count 16

How to design a load Test ? 1. 2. 3. 4. 5. 6. 7.

How to design a load Test ? 1. 2. 3. 4. 5. 6. 7. Identify primary user paths Identify expected concurrent user count and type Plan and Design Tests Configure Test Environments Implement Test Design Execute Tests Analyze, Report, Schedule Retest 17

Stress Testing § The aim of Stress Testing is to determine when under extreme

Stress Testing § The aim of Stress Testing is to determine when under extreme levels of load or an application’s: § Robustness § Availability § Reliability 18

Stress Testing § Stress testing can also be used to check the applications behavior

Stress Testing § Stress testing can also be used to check the applications behavior while being deprived of certain resources e. g. limited memory, insufficient disk space, load from other application/services executed on the same host § Stress testing can also help identify issues that arise or become apparent only under extreme conditions such as sudden spikes in the load 19

Introduction to JMeter 20

Introduction to JMeter 20

Setting up JMeter § You can download the latest version of JMeter from apache’s

Setting up JMeter § You can download the latest version of JMeter from apache’s official download site § After unzipping the binary move the JMeter directory to wherever you want the application to be situated § When working under windows start JMeter using the JMeter. bat file § It is recommended that you read the readme file as changes may occur after each release 21

Introduction to JMeter 22

Introduction to JMeter 22

Elements of a Test Plan Thread Group Samplers Listeners Configuration Elements Timers Assertions Logic

Elements of a Test Plan Thread Group Samplers Listeners Configuration Elements Timers Assertions Logic Controllers Test Fragments Pre-Processor Elements Post-Processor Elements 23

Setting up Jmeter HTTP(s) Recorder Demo 24

Setting up Jmeter HTTP(s) Recorder Demo 24

Setting up Jmeter HTTP(s) Recorder (1) § Good to know: § When recording HTTPS

Setting up Jmeter HTTP(s) Recorder (1) § Good to know: § When recording HTTPS it is sometimes required to manually add JMeter’s security Certificate to your browser’s list of trusted ones and then to set the trust level of the added certificate accordingly § Https recording won’t work sometimes if you start the recorder while being already logged in § It is sometimes helpful to clear browser cache and cookies 25

Setting up Jmeter HTTP(s) Recorder (2) § Good to know: § A HTTP request

Setting up Jmeter HTTP(s) Recorder (2) § Good to know: § A HTTP request defaults element in the Work. Bench module can be used in order to prevent the recorder from populating repetitive information into each and every request § Official online tutorial: Setting Up the HTTP(S) Test Script Recorder 26

How to design a load Test? 1. 2. 3. 4. 5. 6. 7. Identify

How to design a load Test? 1. 2. 3. 4. 5. 6. 7. Identify primary user paths Identify expected concurrent user count and type Plan and Design Tests Configure Test Environments Implement Test Design Execute Tests Analyze, Report, Schedule Retest 27

Load Test Demo 28

Load Test Demo 28

Elements of a Test Plan Thread Group Samplers Listeners Configuration Elements Timers Assertions Logic

Elements of a Test Plan Thread Group Samplers Listeners Configuration Elements Timers Assertions Logic Controllers Test Fragments Pre-Processor Elements Post-Processor Elements 29

Execution order of test elements If you put different types of test elements on

Execution order of test elements If you put different types of test elements on the same execution level in JMeter, they will execute in the following order: 1. Configuration elements 2. Pre-Processors 3. Timers 4. Sampler 5. Post-Processors (unless Sample. Result is null) 6. Assertions (unless Sample. Result is null) 7. Listeners (unless Sample. Result is null) 30

Links you might some day find useful § Setting Up the HTTP(S) Test Script

Links you might some day find useful § Setting Up the HTTP(S) Test Script Recorder § Properties and variables § Javascript function variables § Junit Sampler Tutorial § How to write your own JMeter extension § Using Selenium with JMeter's Web. Driver Sampler 31

Performance, Load and Stress Testing ? s n o i t s e u

Performance, Load and Stress Testing ? s n o i t s e u Q ? ? ? http: //softuni. org/courses

License § This course (slides, examples, demos, videos, homework, etc. ) is licensed under

License § This course (slides, examples, demos, videos, homework, etc. ) is licensed under the "Creative Commons Attribution. Non. Commercial-Share. Alike 4. 0 International" license § Attribution: this work may contain portions from § "Fundamentals of Computer Programming with C#" book by Svetlin Nakov & Co. under CC-BY-SA license § "C# Part I" course by Telerik Academy under CC-BY-NC-SA license 33

Free Trainings @ Software University § Software University Foundation – softuni. org § Software

Free Trainings @ Software University § Software University Foundation – softuni. org § Software University – High-Quality Education, Profession and Job for Software Developers § softuni. bg § Software University @ Facebook § facebook. com/Software. University § Software University @ You. Tube § youtube. com/Software. University § Software University Forums – forum. softuni. bg