Introduction
Quality means doing it right even when no one is looking – Henry Ford
Understanding the Importance of Performance Testing
A slow or unresponsive web application can frustrate users and lead to a poor user experience. With countless alternatives available, users are unlikely to stick around if your application doesn’t perform well.
Introduction to Apache JMeter
Load Testing: Simulating a specific number of concurrent users to determine how well your application handles the load
Stress Testing: Pushing your application to its limits to identify its breaking point.
Functional Testing: Verifying that your application functions correctly under various conditions.
Distributed Testing: Scaling your tests by distributing them across multiple machines.
Continuous Integration: Integrating JMeter into your CI/CD pipeline for automated testing.
How JMeter work?
JMeter works at the Protocol level simulating network requests.
JMeter is not a browser it doen’t execute Javascript.
Simulate Users
JMeter Test Execution
Hardware and Software Requirements
Prior to delving into the installation process, let’s begin by addressing the hardware and software requirements.
Hardware Requirements
1. CPU
To run JMeter smoothly and efficiently, you should have a CPU with at least 4 cores. This will allow JMeter to handle the load testing tasks effectively, ensuring accurate and reliable results.
2. Memory (RAM)
Ideally, your system should be equipped with a minimum of 16 GB of RAM. Having sufficient memory is essential for JMeter to handle large-scale tests and simulate numerous virtual users without experiencing performance bottlenecks.
3. Network
A Gigabit Ethernet connection is highly recommended. A fast and stable network connection is vital when conducting distributed load tests or testing web applications with high concurrency.
Software Requirements
1. Java
Operating System Compatibility:
Installation
Creating a Test Plan
Thread Group
Ramp-up period :
The ramp-up period in JMeter controls how fast it adds threads. Imagine you have 10 threads and a 100-second ramp-up. It means JMeter will take 100 seconds to start all 10 threads. Each thread begins 10 seconds after the previous one. With 30 threads and a 120-second ramp-up, each new thread starts 4 seconds later than the previous one.
Controllers
- Logic Controller
- Samplers
Logic Controller
Let us customize the logic to decide when to send requests. Logic controllers can change the order of a request coming from any of their child elements.
Simple Controller | If Controller |
Loop Controller | While Controller |
Once Only Controller | ForEach Controller |
Switch Controller | Recording Controller |
Sampler
Graph Results | View Results in Table |
Spline Visualizer | Simple Data Writer |
Assertion Results | Monitor Results |
View Results Tress | Aggregate Graph |
Listeners
Graph Results | View Results in Table |
Spline Visualizer | Simple Data Writer |
Assertion Results | Monitor Results |
View Results Tree | Aggregate Graph |
Import Points about Listeners
- All Listeners save the data the only difference is the way of data is presented.
- Listeners can use a lot of memory.
Assertions
Response Assertion | Duration Assertion |
HTML Assertion | Size Assertion |
Compare Assertion | XML Assertion |
XPath Assertion | BeanShell Assertion |
Configuration Elements
HTTP Authorization | JDBC Connection |
HTTP Cache Manager | Login Config Element |
HTTP Cookie Manager | LDAP Request Defaults |
HTTP Proxy Server | HTTP Request Defaults |
Pre-Processor Elements
A Pre-Processor is like a helper that gets things ready before sending a request during performance testing. It can do tasks like setting variables, reading data from files, or modifying URLs. It prepares the ground for your test to run smoothly.
The following table provides a list of these Configuration Elements for your reference:
JDBC PreProcessor | HTML Link Parser |
User Parameters | HTTP URL Re-writing |
HTTP User Parameter | RegEx User Parameter |
Post-Processor Elements
A Post-Processor, on the other hand, steps in after a request has been made and the server responds. It’s like a detective that examines the response, searching for valuable information. It can extract data, check for errors, or perform specific actions based on what the server says. Post-processors help you make sense of the results and take action accordingly.
The following table provides a list of these Configuration Elements for your reference:
Regular Expression | JDBC PostProcessors |
XPath Extractor | BeanShell PostProcessor |
CSS/JQuery Extractor | Debug PostProcessor |
JMeter Execution Order
Here, we present a visual representation of the JMeter execution order in the form of an image.