This document provides an introduction and overview of JMeter, an open source load testing tool. It discusses how JMeter can be used to simulate multiple concurrent users accessing a web application to test performance under heavy loads. The key points are:
- JMeter simulates user requests to test web applications and servers under various load conditions. It can test HTTP, FTP, JDBC and other protocols.
- It uses thread groups to simulate users, with each thread representing one user. Samplers define the type of requests sent by each thread, like HTTP requests.
- Other components configure tests, extract values, add assertions to validate responses, and control timing between requests. Listeners display results in graphs,
2. J Meter introduction:
• It is a open source software from Java to load test functional
behavior and measure performance. Testing a web application
against heavy load, multiple and concurrent user traffic.
• For example: one day, your boss asks you to do performance
testing of www.google.com for 100 users. What would you
do?
• Answer is J-meter
• It will stimulate multiple user at a time as per the request
• JMeter originally is used for testing Web Application or FTP
application. Nowadays, it is used for functional test, database
server test etc.
3. Why JMeter ?
1. JMeter is totally
free, allows developer
use the source code for
the development
2. JMeter is 100% pure Java
desktop application. So it
can run on multiple
platforms
3. JMeter supports many
testing strategies such as
Load Testing, Distributed
Testing, and Functional
Testing.
6. Thread Group
• Thread Groups is a collection of Threads. Each
thread represents one user using the
application under test. Basically each Thread
simulates one real user request to the server.
• The controls for a thread group allow you to
Set the number of threads for each group.
• For example, if you set the number of threads
as 100; JMeter will create and simulate 100
user requests to the server under test
8. Samplers
• As we know already that JMeter supports testing HTTP, FTP , JDBC and many other
protocols.
• We already know that Thread Groups simulate user request to the server
• But how does a Thread Group know which type of requests (HTTP, FTP etc.) it
needs to make ?
• The answer is Samplers
• The user request could be FTP Request, HTTP Request, JDBC Request…Etc.
9. FTP request:
• You can use FTP request sampler to perform test an FTP server
• This controller lets you send an FTP “download file” or “upload file”
request to an FTP server.
HTTP request:
• This sampler lets you send an HTTP/HTTPS request to a web
server.
• JMeter send a HTTP request to Google website and retrieve
HTML files or image from this website.
JDBC request:
• It sends a JDBC Request (an SQL query) to a database.
10. Logic Controllers
• Logic Controllers let you define the order of processing request in a Thread. For
example, you can use Random Controllers to send HTTP requests to the server
randomly.
• Logic Controllers determine the order in which user request are executed.
• commonly used Logic controllers are
11. Recording Controller
JMeter can record your testing steps; recording controller is a place holder to
store these recording steps.
Simple Controller
Simple Controller is just a container for user request.
Loop Controller
makes the user request run specified number of times
12. Listeners
• A listener is a component that shows the results of the samples.
• The results can be shown in a tree, tables, graphs or simply written to a log file.
Configuration Elements
• set up defaults and variables for later use by samplers.
13. • Suppose you want to test a website for 100 users signing-in with different
credentials.
• You do not need to record the script 100 times! You can parameterization the
script to enter different login credentials.
CSV Data Set Configuration
HTTP Cookie Manager
• HTTP Cookie Manager also has the same feature like a web browser.
• If you have an HTTP Request and the response contains a cookie, the Cookie
Manager automatically stores that cookie and will use it for all future
requests to that particular web site.
HTTP request default
• This element lets you set default values that your HTTP Request controllers
use.
Login Configuration Element
• The Login Configuration Element lets you add or override username and
password settings in samplers.
14. Assertions
• Assertion help verify that your server under test returns the expected
results.
• Commonly used Assertion in JMeter:
1.Response Assertion
2.Duration Assertion
3.Size Assertion
4.XML Assertion
5.HTML Assertion
Response Assertion
• The response assertion lets you add pattern strings to be compared against
various fields of the server response.
Duration Assertion
• The Duration Assertion tests that each server response was received within
a given amount of time. Any response that takes longer than the given
number of milliseconds (specified by the user) is marked as a failed
response.
15. Size Assertion
• The Size Assertion tests that each server response contains the expected number
of byte in it. You can specify that the size be equal to, greater than, less than, or
not equal to a given number of bytes.
Timers
• JMeter sends the request without pausing between each request. In that case,
JMeter could overwhelm your test server by making too many requests in a
short amount of times.
• To overcome this we are using timers
• common types of timer in JMeter
Constant Timer:
• Constant timer delays each user request for the same amount of time
Gaussian Random Timer:
• Gaussian random timer delays each user request for a random amount
of time
16. Total Time delay
• Other Timer used in J-meter is Ben shell timer, BSF Timer, JSR223, Uniform
random timer
Processor
• Processor is used to modify the Samplers in their scope.
17. There are 2 Types of processors:
1.Pre-processor
2.Post-processor
Pre-processor
• Pre-processor executes some action before making Sampler Request.
• A Pre-Processor is most often used to modify the settings of a Sample
Request just before it runs, or to update variables that aren't extracted from
response text.
18. Post-processor
• Post-processor executes some action after making a Sampler Request.
• A Post-Processor is most often used to process the response data,
often to extract values from it.
19. J meter : Performance Testing
• Performance testing is crucial to determine that the web application under test will
satisfy high load requirements. It can be used to analyze overall server performance
under heavy load.
• J meter performance testing includes both Load test and Stress Test
• Load Testing Help us to
study the behavior of the
application under various
loads
• The main parameter to
focus is response time.
• Stress Testing Help us to
observe the stability of the
application.
• The main parameter to
focus is throughput.
20. Sample Performance Test Plan in J meter
• performance analysis of Google.com for 10 users
• Before testing the performance of target web application, we should determine-
Normal Load: Average number of users visit your website
Heavy Load: The maximum number of users visit your website
What is your target in this test?
• Roadmap of this practical example
21. Step 1) Add Thread Group
Right click on the Test Plan and add a new thread group
Add –> Threads (Users) –> Thread Group
In Thread Group control panel, enter Thread Properties
A. Number of threads
B. Ramp-up periods
C. Loop count
Step 2) Adding J Meter elements
This element can be added by right-clicking on the Thread Group and selecting
Add –> Configuration Element –> HTTP Request Defaults.
Enter the website you want to test
22. HTTP Request
Right-click on Thread Group and select
Add –> Sampler –> HTTP Request
J Meter will create the URL request to Google server
Step 3) Adding Graph result
J Meter can show the test result in Graph format.
Add –> Listener –> Graph Results
Step 4) Run Test and get the test result
• Press Run button (Ctrl + R) on Toolbar to start the testing process.
• You will see the test result display on Graph at the real time.