0% found this document useful (0 votes)
27 views32 pages

JMeter Documentation ?

JMeter is a performance testing tool used to test web and mobile applications under different load conditions. It can perform load, stress, volume, and soak testing. Some key JMeter elements include thread groups, samplers, listeners, timers, and assertions. Thread groups define virtual users and loops. Samplers generate requests. Listeners display results. Timers determine delays between requests. Assertions validate responses. Controllers help organize test flows and distribute load across elements.

Uploaded by

Anu Selvaraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views32 pages

JMeter Documentation ?

JMeter is a performance testing tool used to test web and mobile applications under different load conditions. It can perform load, stress, volume, and soak testing. Some key JMeter elements include thread groups, samplers, listeners, timers, and assertions. Thread groups define virtual users and loops. Samplers generate requests. Listeners display results. Timers determine delays between requests. Assertions validate responses. Controllers help organize test flows and distribute load across elements.

Uploaded by

Anu Selvaraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

JMETER DOCUMENTATION (PERFORMANCE TESTING)

What is JMeter? JMeter is a performance testing tool used for testing the web-based application and Mobile based
applications to check the overall performance of the application by applying the number of loads i.e., users.

What is the use of JMeter? JMeter is basically used to apply the load on various phases like-

load, stress, volume, and soak testing:

 Load Testing - within the requirement (As per the load ex-100 users=100 users)
 Stress Testing - Against the requirement (beyond) ex-100 users = 500 users
 Volume Testing - Transferring a huge amount of data.
 Soak Testing - Transfer huge data within a specific period of a time.

Advantages of JMeter:

 Open-source tool
 GUI user-friendly (Graphical user interface)
 Execution Result-Multiple Formats

JMeter elements? Examples? The elements available in the JMeter tool are known as JMeter elements.

Example- thread group//sampler//listeners etc.

How to create your first JMeter Test case execution? what all pre-requisites we must follow:

 Open JMeter
 Test plan
 Thread group
 Samplers Listeners save the plan and Execute the Test plan- once at a time [Execute]

Prepared By: Dipti Ranjan Dash 1


What is the Test plan? A test plan is a document that stores thread group//samplers//listeners//and multiple
operations.

What is the Thread group? - Number of users we must define here lest say from 0-1000 to user need.

Types of Thread groups-

What are samplers? - Request, Multiple requests available.

Types of samplers-

What are Listeners? output results/report generate for analysis the performance response.

Prepared By: Dipti Ranjan Dash 2


Multiple formats are available graph, summary, report, aggregate report, html.

Types of Listeners-

What are Timers? Types of timers available? Which do we use the most? Timers are the time for the sampler-
request to perform when and how at what time. Also, we do have multiple Timers.

Constant timers and Uniform random timers

This two are widely used by timers.

pre-requisite (Timer should be created before the sampler calling)

Prepared By: Dipti Ranjan Dash 3


Timeout periods-

1sec = 1000ms

1min =60sec

1hr = 60min

24hrs =1440min

What is correlation? The relation between two samplers is known as co-relation. Example- Request1- will get some
response data - from that response, we must fetch the data (which we required) and store it into a variable and pass
it into the second Request2.

What is a regular expression extractor?

syntax- <a href="(.*)">

URL to access regex - https://regexr.com/6jvcr

variable calling- ${dipti}

What is the difference between constant and uniform Random timers? (Difference usage)?

Constant timer = fixed timer

Example- 1000/2000/5000

1sec= 1000ms

Uniform random timer =

Random delay maximum (in milliseconds) - 5000

Constant delay offset (in milliseconds) - 1000

If the request is fetched under 1000 ms then it will not go for 5000

If not, then it will wait and search for 5000.

Doubts/concerns on JMeter?

Execution result- No. of users 1-1/No. of users, 1-2 under thread name what is this?

Sampler = 1(Request)

User =2

Prepared By: Dipti Ranjan Dash 4


Two users performing a single sampler/request.

Bytes//Latency//Sent bytes//Connect time MS//time//hits-per sec.

 1byte - 8bits
 Latency - internet connections.
 sent bytes - how many bits sent have been done for the request.
 connect time - How much time does it take to connect to the server.
 Hits- per sec -How much time it took to fetch a request on a basis of seconds.

Example-(output)

Thread Name:SC14_DTAC_BalanceTransfer_API 1-1

Sample Start:2023-02-13 11:05:29 IST.

Load time:1889

Connect Time:0

Latency:1889

Size in bytes:712

Sent bytes:1557

Headers size in bytes:458

Body size in bytes:254

Sample Count:1

Error Count:0

Data type ("text"|"bin"|""):text

Response code:200

Response message:OK

HTTPSampleResult fields:

ContentType: application/json

DataEncoding: null

Prepared By: Dipti Ranjan Dash 5


How to create multiple test plans in a single time/window? Without deleting others.

JMeter does not support multiple test plans for a single window. (Limitation)

Exercises Practiced- [Basic Topics on above]

1. Creating a first JMeter test case with a single execution result?

2. Creating a second JMeter test case with multiple execution results?

3. Creating a test case with Timer execution result?

for timeout period- 1000/2000/5000/20000 etc. [constant timer//uniform timer]

4. Creating a test case with a regular expression extractor?

5. Creating a test case with a regular expression extractor for multiple formats of listeners?

Assertions- types of assertions? Assertion means simply verifying the data fetched by the server for a particular
request. For example- response code//response message//size//duration

Types of assertions-

Response assertion

Duration assertion

Size assertion

Html assertion

XML assertion

X-path assertion

JSON assertion

XML-schema assertion

Prepared By: Dipti Ranjan Dash 6


Creating an assertion test case with duration/response assertions format?

Logic Controllers in JMeter? The work is to control the samplers [In order to set how to execute and when to achieve
the requests]

Types of Logic controllers-

 Loop controller - Execute a single request multiple time.


 Interleave controller - multiple requests will execute all in order-wise.
 Throughput controller - distribute the load into various samplers with the percentage setting
depending upon the users.
 Random controller - It will execute each time a unique/dynamically request [will not follow
order wise//not execute all requests]
 Random order controller - It will execute all the requests randomly and will not follow any sequence.
 Transaction controller - Transit the data from a - b as say.

Prepared By: Dipti Ranjan Dash 7


What are the configuration elements? Types of configuration elements?

What is the use of a controller in JMeter?

To handle multiple requests for multiple operations, we must follow this sequence.

write a test case for a logic controller? By using a loop controller?

write a test case for a single request executed 10times where others request by default?

Doubts/concerns on JMeter?

Can we perform a single request or multiple requests? can we perform multiple requests in JMeter? Yes, we can
create and follow multiple [no. of request]

Why is HTTPS request-0/request-1 happening? under view results tree?

Because we have selected the

Follow redirect [option present in the sampler] as a ticked that's why we are getting it.

By default, executing time? How much is it? 1000ms?

Depending upon the request/URL it will take some time to execute the response. [varies]

It doesn't follow any default time for fetching.

What is a simple controller? and the uses?

Simple controller- a container that stores multiple requests in it[depending upon the requirement]

Prepared By: Dipti Ranjan Dash 8


What is a module controller? and the uses?

If we want to execute requests multiple times we go for this controller (child to parent calling).

What is a Test fragment controller? and the uses?

A test fragment controller is almost the same as a simple controller [which stores multiple samplers]

What is the included controller? and the uses? Same as module controller operation. creating a test case with a
simple module and Test fragment, including a controller with execution result? -[Execution workflow not worked
correctly]

What are Random and Random order controllers?

 Random controller - This will execute only one request at a time [i.e., dynamically]
 Random order controller - This will execute all the requests, but it should be dynamic [on each execution]

Difference between simple controllers and random order controllers?

simple controller - A container that stores single/multiple requests.

[will follow the order in which we set them]

Random order controller - will not follow any order.

What are Random and Random order controllers in JMeter?

creating a test case with Random and Random order controllers with execution results.

practical exercises.

Difference between simple controllers and random order controllers?

What is an interleave controller? Usage?

This controller will follow and execute the first request only (For multiple requests if there it will select only the first
request)

What is a throughput controller? practical?

A throughput controller is used to distribute the load across multiple requests.

Depending upon the user- The user should carry forward with the percentage.

example- 2users = 20%

5users = 50%

Prepared By: Dipti Ranjan Dash 9


pre-requisite - main thread group

Why do we use a throughput controller? Advantages? To ignore thread groups for huge/complex scripting.

Practical showing the overall JMeter scripts-

Prepared By: Dipti Ranjan Dash 10


HTTP Methods//HTTP Request

GET Request - Get method is used to select/fetch the data from a database server.

whenever a URL is hit by the client/requested by the client end side.

POST Request -To create a new set of data on the database server by applying some.

input [ i.e., on Response body]

PUT Request - To update the data present inside the database server.

pre-requisition to follow- we must create new data by applying POST requests.

DELETE Request - If want to delete a new data/existing data available on the database server. (Is to remove the data
permanently)

Request//Response-
What is the request?
A client sends a request to fetch some data from the database server.
Example- If a client wants to open a Flipkart application.
Then he/she must open the browser.
Type the domain name and URL.
Search for it- front end application will open (Flipkart).
So, the application will open using a database server. [That was hit by the users]
In short - A user request = response data.

Prepared By: Dipti Ranjan Dash 11


Regular Expression Extractor-Note
Concept/Fundamental-
Request1- when we hit request-1 it will get some response data and within the response, we must fetch some more
data.
Then in that condition, we must use a Regular expression extractor to fetch the data.

we must create a regex syntax for that element by using-


Example- "msisdn":"(.*?)" store this into a variable and over-ride to the request-2 sampler.

steps to follow:
1. Go to view results tree format Report-
Go to response data- Response body- select the proper attribute name with the attribute value. (Whichever we
need)
Example- "msisdn":"666777822222625",

2. copy the selected element and paste it into the search bar- with case sensitive and regular expressions (Ticked)

3. click the find button- it will show the element with green highlighted below the response body.

4. Then follow the proper syntax for dynamic element fetching- By using (.*?)
example- "msisdn":"(.*?)",
(By default, the format will be in - text)

5. To check and cross verify the expression syntax-


make it to - RegExp Tester.
under Regular Expression- paste "msisdn":"(.*?)", and hit to Test.
output-
Match count: 1
Match[1][0]="msisdn":"666777822222625",
Match[1][1]=666777822222625

Note:
we can also do the same operation on this site- https://regexr.com/

Prepared By: Dipti Ranjan Dash 12


Text Formation- (verification in JMeter)

Reg-Exp Tester Formation (verification in JMeter)-

Prepared By: Dipti Ranjan Dash 13


Open site (Reg-Exp)-

Key Points (JMeter):


1. How to install JMeter Tool on windows and mac os?
2. Scope of the JMeter in the future?
3. How to write your first JMeter test case? What steps do we have to follow?
What is the difference between the stop button and a shutdown button?
Stop- execution stop forcefully.
Shutdown- stop the currently running thread execution.

4. What are Assertions? How to use Assertions?


Verification of the data present in the response data is called an Assertion.
Types of Assertions-
Response assertion
Duration assertion
Size assertion
Html assertion
Xml assertion
Xml schema assertion
X-path assertion

5. what/How to use listeners?


To generate the output values of a request/samplers is called Listeners.
Types of listeners?
View results tree
View results in table

Prepared By: Dipti Ranjan Dash 14


Aggregate report - single line output 99% line = max [both are same]
Graph Results- do not use in heavy load period.
Summary report
Simple data writer - write the output into a file format.csv, excel any format.

Latency - time to the first byte


Example-
1001ms—----------------------------
user—---------------------1000ms
Oms—----------------------------------------------------------------5000ms

Connecting time-
How much time does it take to connect to the server [following multiple activities]

6. How to record UI (web) Tests?


We can record and perform the scenario by using two tools-
1. Badboy tool (available for windows)
2.BlazeMeter tool (available for windows and mac OS)
Practical practiced and implemented successfully worked- By using Blaze meter tool.

Recording controller-
If we want to record a scenario based on the requirement and user needs.
At that stage we will use JMeter for recording or else we can also use Blaze Meter,
a bad boy Tool (Performance testing tool).

Prepared By: Dipti Ranjan Dash 15


7.JMeter how to test the login page? using Blaze Meter tool?
By using the Blaze Meter tool, we can record the scenario whichever we want.
To perform can execute it into the JMeter tool.

8. what are configuration elements? Types of configuration elements?


By default, variables will store data for reused again for the samplers.
Types of conf. elements?
1.csv data set conf.
2.http header manager
3.HTTP cookies manager
4.HTTP request manager
5.HTTP cache manager etc.

Prepared By: Dipti Ranjan Dash 16


9. How to create a database test plan?
Steps to follow-

How practical we can implement-

For creating a database in the server, we can use the link-


https://db4free.net/

Note:
On the developer Tool, we have Headers Tab- (under the Network Tab)
Example URL- https://www.google.com/
General
Response Header
Request Header

Prepared By: Dipti Ranjan Dash 17


JMeter Tool- GUI mode
Command-Line - Non-Gui mode
How to run JMeter scripts in the command line/prompt?

10. How to test FTP upload and download?


FTP- file transfer protocol
(Means we must transfer the data from the local system to the remote system)
and we can also do the reverse process to check and validate.

11. How to use plugins manager?


Plugin- extension means adding a new feature to the JMeter tool for performing certain.
New features

Prepared By: Dipti Ranjan Dash 18


Advantages-
Easy adding a new feature.
Hassle-free usage
No need to add plugins manually.

Note:
To access all the plugins in the JMeter Tool, we must use the link.
https://jmeter-plugins.org/wiki/PluginsManager/
Download the jar file and paste it into the ext. folder- JMeter/lib/ext. Paste the jar file.

12. How to read data from CSV files? Parameterization?


CSV data set configuration- To read data from the file [Data driven testing] we use this concept.
We can do parameters in two ways-

Internal parameter

Prepared By: Dipti Ranjan Dash 19


And External parameter
The external parameter can perform by using- the CSV data set config.

Understood all the features available inside the CSV data set config. Element.
(Practically practiced each bit-by-bit operation)

Syntax parameterization - ${Variable_name}


13. What are functions and variables?
JMeter functions are special values that can populate fields of any Sampler or other element in a test tree. A function
call looks like this: ${__functionName(var1,var2,var3)} Where "__functionName" matches the name of a function.

Variables- simply container which stores the data/value inside the variable for further calling/using it into the
samplers.

Functions in Jmeter-

Prepared By: Dipti Ranjan Dash 20


${__functionName(var1,var2,var3)} - with argument
${__functionName} - without argument

There are different types of functions available -


Link - https://jmeter.apache.org/usermanual/functions.html
Function Helper-
This will show the types of functions we have in the JMeter tool.
Variables In JMeter- syntax- ${variable_name}

Theory Concept-

Functions-Types[syntax]
${__log("diptidash")}
${__time("dd/mm/yyyy")}
${__intSum(10,20)}

14. How to set up realistic performance test- pacing?

Prepared By: Dipti Ranjan Dash 21


To perform a real-time performance test, we must set up a stepping thread group plugin.

Practical concept-

What are timers and types of timers? How to add think time?
Timers = Time period [Timeout seconds]
Types of timers- [mostly used this timer in real time]
1. constant timer- fixed timer ex-1000/2000/3000 delay time.
2. uniform random timer- Dynamic time.

Prepared By: Dipti Ranjan Dash 22


How to parameterize the FTP test?
If we want to add a dynamic value from the CSV file each time of execution at that condition, we are going to use
this scenario.

Steps to follow-
(To upload files with different names to FTP)
Step 1: add CSV Data Set Config
Step 2: Create a CSV file and provide its location in CSV Data Set Config
Step 3: parametrize FTP PUT request to take value from CSV file.
Step 4: Run and Validate

Prepared By: Dipti Ranjan Dash 23


How to run scheduled and sequential execution in JMeter?

HOW TO RUN A TEST FOR A SPECIFIC DURATION


Thread Group - Forever - Scheduler - Duration

HOW TO RUN PERFORMANCE TESTS SEQUENTIALLY


Test Plan - Run Thread Group Consecutively

HOW TO ADD WEBSITES SEQUENTIALLY TO A PERFORMANCE TEST


Thread Group - Forever - Scheduler - Duration + Startup Delay

HOW TO RUN A TEST FOR A SPECIFIC DURATION


Thread Group - Forever - Scheduler - Duration

Step 1: Thread Group - make loop count = forever


Step 2: Select the Scheduler checkbox.
Step 3: Add duration (sec)

HOW TO RUN PERFORMANCE TESTS SEQUENTIALLY


Test Plan - Run Thread Group Consecutively

Step 1: Test Plan - select Run Thread Groups consecutively.

HOW TO ADD WEBSITES SEQUENTIALLY TO A PERFORMANCE TEST


Thread Group - Forever - Scheduler - Duration + Startup Delay

Step 1: Add duration (max) to first thread group - 30 sec.

Step 2: To consecutive thread, groups add delay.

example (for a 30 sec test plan):


1st Thread Group: delay = 0 sec | duration = max duration of the test = 30 sec

2nd Thread Group: delay = 10 sec | duration = max - delay = 30 - 10 = 20 sec

3rd Thread Group: delay = 20 sec | duration = max - delay = 30 - 20 = 10 sec

Prepared By: Dipti Ranjan Dash 24


What is correlation? Why is it required? What is a regular expression extractor?
Regular expression extractor-
Syntax- <a href=”(.*?)”>

We can use the Regex.com website for the regex concept.


Link- https://regexr.com/
Else we can also select Regex Tester- for creating expression within the response data itself for verification.

Note:
Regex is easy for creating the expression syntax for the sampler.

Prepared By: Dipti Ranjan Dash 25


Showing how the session id is linked to each other [requests]

Practical screenshots-

Prepared By: Dipti Ranjan Dash 26


1. What are JMeter Templates Reusable project scripts
Users can select any template and it will generate a Test Plan with basic and necessary components.

2. How to use Templates File - Templates - select a template and start building over it.

3. How to create your own Template

Step 1: save your test plan as a .jmx file.

Step 2: place the. jmx inside JMeter/bin/templates

Step 3: edit the templates.xml file to add your template.

Step 4: restart JMeter and check

templates.xml template
isTestPlan=”true” : template will create a new test plan
isTestPlan=”false” : templat will be merged into existing test plan
name : Name of the template
fileName : location of .jmx file
description : description will be displayed in html

Prepared By: Dipti Ranjan Dash 27


How to Create Your Own Templates:

Practical -
How to test file upload?
1. How to create a test for file upload
2. How to record test for file upload

1. How to create a test for File Upload

Step 1: Create a Test Plan - Thread Group - HTTP Request

Step 2: Add values in the HTTP Request sampler.

Step 3: Add File Upload details.

Step 4: Add Listeners to view results.

Step 5: Run and Validate

2. How to record test for File Upload

Step 1: Add Template - Recording

Step 2: Provide a port number (e.g., 8181)

Step 3: Set the browser to listen to this port.

Step 4: Start Recording

Step 5: Filter the samples you need from recorded samples.

Prepared By: Dipti Ranjan Dash 28


Step 6: Run and Validate

Helping Tips:
In case you face any issues
Check the following:
In case you face any issues in recording the scenario...
Watch:
https://youtu.be/amEHuq8auTU?list=PLh...

References:
http://www.tinyupload.com/
http://www.freeformatter.com/mime-typ…

How to test file download?


1. How to create a test for file download

 Add Thread Group - HTTP Request sampler.

 Add values in the HTTP Request sampler.

 Add Listeners to view results.

 Add Listener - Save Responses to a file.

 Add values to this Listener.

 Run and Validate

Helpful Tips:
How to avoid overwriting downloaded files.
in a multi-user test

Use function: ${__threadNum} as Prefix.

References:
ftp://speedtest.tele2.net/

Prepared By: Dipti Ranjan Dash 29


How to debug in JMeter?
1. How to debug and fix errors
2. How to use Debug Sampler

Step 1 : Analyse with Listener - View Results Tree


Step 2 : Analyse information in Log Viewer
Step 3 : Add Listner - Debug Sampler

Helpful Tips

How to use Debug PostProcessor


Enable Debug for elements.
Using external plugins for Debugging

References:
How to use Plugin Manager:
https://youtu.be/KQfoBOK37ms?list=PLh...

JMeter Script Run in CLI


Testing JMeter scripts in the command prompt-||Command Line Interface [CLI]

How to run JMeter from command line?


command- jmeter -n -t "location-path of jmeter script file" -l "location-outputfolder-path"
 -n (non-gui mode)
 -t (location of test script file)
 -l (report/output file location)

Examples:

Prepared By: Dipti Ranjan Dash 30


Note:
we can capture the CSV file [sometimes captured info. sometimes not]
we cannot capture the Html file directly.

(workaround)
we can capture the CSV file by using JMeter 5.4.3V but not able to capture HTML so in -order to do this we can
go for Apache JMeter 5.5 version under the bin folder paste the HTML (folder) and CSV which was taken by JMeter
5.4.3 version on executing.

And use this command- (only on JMeter 5.5 version)


To capture the HTML report in the web.

use this command- JMeter -g Report.csv -o Html.

Point to remember always run all these commands only in- (bin directory)
Example-
C:\Users\xyz\Downloads\apache-jmeter-5.5\apache-jmeter-5.5\bin>

Prepared By: Dipti Ranjan Dash 31


Quick Links to Learn-
https://www.youtube.com/watch?v=M-iAXz8vs48&list=PLyZDoc-Wc-9xCAkzVYDOxB_f4RE_MkPUM
https://www.youtube.com/watch?v=817zU_bXh9Y&list=PLUDwpEzHYYLs33uFHeIJo-6eU92IoiMZ7
Apache JMETER Documentation- https://jmeter.apache.org/usermanual/index.html

THE END

Prepared By: Dipti Ranjan Dash 32

You might also like