JMeter Beginner Guide 101

sandeep negi
5 min readMay 27, 2021

Here is a brief overview of what all we will be covering in this series of tutorials:

  • Components of JMeter
  • Test Plan, Test Scenarios Creation in JMeter and Thread Group
  • Timers
  • Samplers, Controllers, Processors, Config Elements and Listeners
  • Assertions and test execution
  • Performance Tuning

it is also a great tool to test other application areas like APIs, FTP servers, database performance, etc. It helps to measure and analyze the performance of web applications and other variety of services.

How would you test your website in such a situation? How can you apply such a huge load on web servers and get results?

In such situations, a tool that can simulate real-time user’s behavior is required and thankfully, JMeter is such a tool that can help you do such testing. JMeter has proved to be the best tool for load testing so far.

Advantages of Jmeter

  1. Free open source tool
  2. multiple platform support
  3. record and playback
  4. famous → so it has many resources
  5. FTP →performave
  6. Database → performance
  7. Reports → different types of reports available → such as numbers and graph
  8. Non GUI-Mode to → to provide even more load

With the increase in load, the different components in the web application provide different response times.

#1) Add Thread Group:

Based on the expected number of users, the tester can define the threads (each thread represents a user), loop count (means how many times the test must repeat), and Ramp Up Period (means how much delay must be applied before starting the next user).

For Example, if the expected number of users accessing the website is 100 then tester sets the thread to 100 and sets a ramp-up period of 10 sec, there will be a delay before starting users would be 10 seconds (100/10).

#2) Add JMeter elements:

Elements are added through Samplers (as shown in the below image).

Elements tell JMeter about which type of request is sent to which server and with what parameters. HTTP Request, FTP Request, JDBC Requests are a few of the commonly used elements.

Elements → tells us which type of requests we want to send

Thread Group → sampler → choose the type of requests.

#3) Add Graph Result:

The Listener lists various reports that provide the tester with a variety of graphical analyses of performance reports. The tester can set different reports to measure the performance.

Listerners → reports

omponents Of JMeter

Penning down again for your reference:

  • Test Plan
  • ThreadGroup
  • Samplers
  • Listeners
  • WorkBench
  • Assertions
  • Config Element
  • Logic Controllers
  • Timer
  • Latency: It is the time when the first piece of information is received i.e. the first byte of data is received
  • Connect Time: It is the time taken to establish connection with the server
  • Sample Time: It is the time taken to receive complete data
  • Sample — Sequence of sample number
  • Bytes — Size of data received.

Work Bench

A workbench is a place where you can store those elements which are not in use in your current test plan but which can be later copy pasted in it. When you save JMeter file, the components which are present in workbench are not automatically saved. You must save them separately by right clicking and choose “Save as “option.

Assertions

Assertions are simply validations which we need to put on responses to compare the results.

Below are the types of assertions commonly used:

  • Response Assertion
  • Duration Assertion
  • Size Assertion
  • XML Assertion
  • HTML Assertion

Response Assertions :

it is similar to postman , that we do ,we check the particular response code or we verify the response using the response body

Screenshots of failing assertions.

Duration Assertion

Duration Assertion is very important and validates that the server responded within a given amount of time.

This can be used in scenarios where we need to sample 100 requests and ensure that every time response is received within the benchmarked limit.

→ duration assertions is very important , we can assert like the response is received within that time or not

Config Elements

Requests sent to the server can be further parameterize using some config elements which are executed before the actual request. A simple example of it could be reading values of a variable from a CSV file for which CSV Data Set Config is used.

Below are some of the important config elements used in the performance testing of the web and mobile applications

  • CSV Data Set Config.
  • User Defined Variables
  • HTTPS Requests Default
  • HTTPS Cache Manager
  • HTTPS Cookie Manager

It will basically used to get parameterize the request

CSV Data Set Config

CSV data set config helps Jmeter in picking values of some parameters from a CSV file rather than passing different parameter in each separate request. For example, if we need to test login functionality with a different set of users and passwords, then we can create two columns in a CSV file and enter the values there so that JMeter can pick one for each request sent to the server.

Below is the flow of using CSV data set the config to test weather API for different cities in India.

  • Adding CSV data set config element to test plan

User Defined Variables

It helps Jmeter to pick values from a pre-defined variable. For example, support that you need to create a test plan in which you need to add many HTTP requests on the same URL and there could be a scenario in which client plans to migrate it later to some different URL.So, to avoid updating URL in each request we can tell JMeter to pick the URL from a UDV (User Defined Variable) which can be later updated to handle all requests to updated URL.

So, to avoid updating URL in each request we can tell JMeter to pick the URL from a UDV (User Defined Variable) which can be later updated to handle all requests to updated URL.

→ it is similar to postman → we can create some variable for the endpoint and that can be used , so if in future that endpoint is changed we just need to change the variable values.

HTTP Request Defaults

This config element is very useful for specifying the default values of https requests. To guide you more, take an example where we need to hit 50 different requests at google server.In this scenario, if we add an HTTP Request Default then we need not specify a server name, path or any other properties like port number, connection time out properties. Whatever is specified in the HTTP Request Default config element is inherited by all HTTP requests.

In this scenario, if we add an HTTP Request Default then we need not specify a server name, path or any other properties like port number, connection time out properties. Whatever is specified in the HTTP Request Default config element is inherited by all HTTP requests.

Please see below how to add HTTP Request Default and specify server and path.

HTTP Cache Manager and HTTP Cookie Manager are used in making JMeter behave as a real-time browser. HTTP Cache manager can clear cache after each request whereas the other one can manage the cookies settings.

Whatever we will give to the http request defaults it will automatically inherited to all the requests.

Here i have given some default values and it will be inherited to other http request in the same thread group.

--

--

sandeep negi

Software Engineer, who loves challenges and new technologies. :)