The Apache JMeter application is open-source software, a 100% pure Java application designed to load functional test behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.

JMeter is a Java desktop application with a graphical interface that uses the Swing graphical API. It can, therefore, run on any environment/workstation that accepts a Java virtual machine, for example − Windows, Linux, Mac, etc.

Introduction to JMeter

Advantages of JMeter

  • Full-featured Test IDE that allows fast Test Plan recording (from Browsers or native applications), building, and debugging.
  • CLI mode (Command-line mode (previously called Non-GUI) / headless mode) to load test from any Java-compatible OS (Linux, Windows, Mac OSX, …)
  • A complete and ready to present dynamic HTML report
  • Easy correlation through the ability to extract data from most popular response formats, HTML, JSON, XML or any textual format

Installation of JMeter

How JMeter can be used for Performance Testing

JMeter can be used to test the performance of both static resources such as JavaScript and HTML, as well as dynamic resources, such as JSP, Servlets, and AJAX.

JMeter can discover the maximum number of concurrent users that your website can handle
JMeter provides a variety of graphical analyses of performance reports.

How to Use JMeter for Performance Testing

Installation of JMeter

  • Go to Google Chrome and then search for JMeter Download in the browser and select the first one search-for-jmeter-in-google-chrome
  • Click on the Download Apache JMeter link, the Apache JMeter Page will open, as shown below.
    download-apache-jmeter-page-in bwoser
  • We have to download JMeter from Binaries, If you are working on Linux or MAC, then you need to download from .tgz extension.
  • After download, extract the file from Zip format, and then save the file in your folder
  • Next, go to the JMeter extracted files and then go to the Bin folder and then search for the JMeter. Batch file and click on it to launch the JMeter.

Installation of JMeter

Recordring Test Scripts in JMeter

Record Testing help tester to record & run their activity against test target. It is a type of automated testing but for multiple users. This tutorial guides you on how to use Proxy Server to record your Test.

The Proxy Server allows JMeter to watch and record user activity while they are browsing web application with a normal browser.

The most important component in HTTP(S)TestRecorder is which can record the scripts directly, and the tester can put the load on those later on.

Recordring Test Scripts in JMeter

Thread Group in JMeter

A Thread Group is a set of threads executing the same Scenario. It is the base element for every JMeter test plan

There are multiple thread groups available that can be configured to simulate how the users interact with the application, how the load is maintained, and over what period of time.

The Types of Thread Groups are :

  • Arrival Thread Group.
  • Concurrency Thread Group.
  • Freeform Arrivals Thread Group
  • Stepping Thread Group
  • Ultimate Thread Group

Thread Group in JMeter

The cookie manager stores and sends cookies just 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.

If your application has a session or uses cookies, then your script will not work without adding cookies in the cookie manager, as then your script will not be able to maintain the session and the users (Threads) will be kicked-off the application as soon as they enter into it.

HTTP Cookie Manager in JMeter

Assertions in JMeter

The assertion in JMeter is used to validate the response of the request, that you have sent to the server. The assertion is a process where you verify the expected result with the actual result of the request at run time. If you need to apply assertion on a particular Sampler, then add it as a child of that Sampler.

Types of Assertions are :

  • Response Assertion
  • JSR223 Assertion
  • Duration Assertion
  • Size Assertion
  • Compare Assertion
  • File Type Assertions

Assertions in JMeter

Controllers in JMeter

The Controllers help you to control the flow of the order of processing of samplers in a thread. It can also change the order of requests coming from their child elements.

The different types of Controllers In JMeter are:

  • Recording Controller
  • Simple Controller
  • Loop Controller
  • Random Controller
  • Module Controller

Logical Controllers in JMeter

Listeners in JMeter

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.

To view the contents of a response from any given sampler, add either of the Listeners View Results Tree or View Results in the table to a test plan.

  • Non-listeners
  • Minimal listeners
  • Pretend listeners
  • Active listeners

Listeners in JMeter

Timers in JMeter

Timers are one of the simplest, yet most powerful tools in the range of any JMeter user. There are many types of timers available to meet the various scenarios you may be trying to simulate with JMeter.

There are 9 different types of built-in Timers are available in JMeter :

  • Constant Timer
  • Uniform Random Timer
  • Precise Throughput Timer
  • Constant Throughput Timer
  • Constant Throughput Timer
  • JSR223 Timer

Timers in JMeter

Samplers in JMeter

Samplers in JMeter are added as a child of Thread Groups. These are used to send different types of requests to the server.

Once, the sampler request is processed by the server, its response is returned to JMeter and the same can be viewed and analyzed in terms of different performance parameters like response time, Hits per second, throughput, etc.

Types of Samplers :

  • HTTP Request
  • JDBC Request
  • XML/SOAP RPC Request
  • Test Action
  • FTP Request

JMeter Interview Questions and Answers

BeanShell Sampler in JMeter

BeanShell is one of the most advanced JMeter built-in components. It supports Java syntax and extends it with scripting features like loose types, commands, and method closures.

If your test case is uncommon and implementation via embedded JMeter components becomes tricky or even impossible, BeanShell can be an excellent option to achieve your objectives.

The Beanshell sampler has pre-defined variables that you can use in the script. By default, JMeter supports Beanshell so you can write and run Beanshell scripts in the Beanshell sampler.

Beanshell in JMeter

PreProcessor and PostProcessor in JMeter

A processor is used to modify the Samplers in its scope.
There are two types of processors :

A preprocessor is a component that is invoked before passing the data to the external data source. This enables the developer to include any business logic on the data before forwarding the request to the external data source.

A postprocessor is a component invoked after the data is received from the external data source but before that data is returned to the mobile device. This enables the developer to include any business logic on the data before sending the response to the mobile device.

PreProcessor and PostProcessor in JMeter

Wen Service APIs in JMeter

Restful Web Service is a lightweight, maintainable, and scalable service that is built on the REST architecture.

Restful Web Service, expose API from your application in a secure, uniform, stateless manner to the calling client.

  • The calling client can perform predefined operations using the Restful service.
  • The underlying protocol for REST is HTTP.
  • REST stands for Representational State Transfer.

Restful Web Services Testing in JMeter

Parameterization in JMeter

Parameterization is the act of creating different data sets for different users in the same test script. Or Parameterization is passing some parameters or inputs to the requests, and this can be achieved by using the parameterization concept in JMeter.

  • JMeter Internal Parameters : in this case, we can define parameters internally and define those parameters anywhere in the JMeter.
  • Read Parameter Values from CSV/Excel file : In this case, we pass multiple parameters by creating one CSV file. We can read the parameter values from the same CSV file and give the same thing to the request. This process is also called as Data-Driven Test.

Restful Web Services Testing in JMeter

Functions and Variables in JMeter

JMeter Functions: JMeter functions are special values that can populate fields of any Sampler or other elements in a test tree. The Syntax for JMeter Function is as below:


JMeter Variables: Container that can store a value that can be referred by any other element within the thread. The Syntax for JMeter Variables is as below:


Restful Web Services Testing in JMeter

JMeter Templates

JMeter Templates are skeleton scripts that you can reuse to get started with a project. You can either use existing templates or create your own. You can also create snippets of code that you can insert into your script with templates.

Each existing template has a description and useful links to understand each and every element in the created test plan.

JMeter Templates

Regular Expression Extractor in JMeter

Regular expressions are a tool used to extract a required part of the text by using advanced manipulations.

Regular expressions are popular when testing web applications because they can be used to validate and to perform operations on a response from a web application.

In JMeter, the Regular Expression Extractor is useful for extracting information from the Response. For example, when you request a page and then need to get a link from the page that was downloaded.

Regular Expression Extractor in JMeter

Creating a Database Test Plan Using JMeter

Database Load Testing helps in identifying the performance problems before you deploy your database applications for end-users.

  • It helps you design and simulate usage traffic, which can be used to test your Database application infrastructure for performance, reliability, and scalability.
  • Load Testing of Database applications involves testing the performance and scalability of your Database application with varying user load.
  • Database Load testing involves simulating real-life user load for the target Database application.
  • It helps you determine how your Database application behaves when multiple users hit simultaneously.

Creating a Database Test Plan/Load Test On Database Using JMeter

Run JMeter in Command Line

A command-line interface (CLI) processes commands to a computer program in the form of lines of text. The program which handles the interface is called a command-line interpreter or command-line processor.

Operating systems implement a command-line interface in a shell for interactive access to operating system functions or services.

We are going to execute the JMeter Tests in Non-GUI mode. Before that, we need to understand why we need to Execute the Test In Non-GUI mode.

Run JMeter in Command Line

Distributed Testing in JMeter

Distributed Testing enables having a local JMeter (master) that handles the test execution, together with multiple remote JMeter instances (slaves) that will send the request to our target server.

Distributed Testing is a kind of Testing that uses various systems to perform Stress Testing. Distributed testing is applied for testing websites and server applications when they are working with multiple clients simultaneously.

Distributed Testing in JMeter

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions