top of page

Let’s Learn API Performance Testing using JMeter


When many users use an application, it should be tested for its performance and stability. Performance Testing is a non-functional software testing, in which we test the application’s response under various workloads. This can be done by simulating users as per production in the QA environment and testing the application’s response.

If the application crashes in production, it loses its customers, money, and reputation. To avoid such an unwanted situation, performance testing comes into the picture.

API Performance Testing Tools

There are so many tools available for API Performance testing in the market.

1. Apache JMeter

2. Taurus

3. BlazeMeter

In this blog, we are going to see about Apache JMeter.

Why Apache JMeter?

1. JMeter is an open-source tool.

2. It is a Java-based tool that supports all Java-based applications.

3. It can be integrated with many tools such as Newman, Jenkins, etc.

4. It is a lightweight tool. It does not need any installation. Just download, unzip, and start work on it.

System Requirement

JMeter is an open-source software from Apache. To start with JMeter, the following are the system requirements.

1. Java 8.0 or later version

2. Windows 7 or later version

3. RAM 2 GB

To download JMeter

Note: JMeter works on Java. Make sure that Java is installed in our system and the Environment variable JAVA_HOME is set before downloading JMeter.

1. Download JMeter from the url

2. Click on the zip file under Binaries and download

3. Once the download is completed, unzip it. For JMeter, installation is not required. Go to the ‘bin’ folder.

4. Double-click on the jmeter.bat file.

5. We will see a command prompt and Apache JMeter will be started after a few seconds.

6. To change the background of the JMeter screen to White, Click on

Options -> Look and Feel -> Windows and confirm with Yes.

Components of the Test Plan

  • Thread Groups: These define how to run the Test Plan, and consist of a set of steps. It is the starting point of the Test Plan. All Controllers and Samplers should be placed under a Thread Group.

  • Controllers: There are 2 types of Controllers. One is Samplers, other is Logical Controllers. These are responsible for the processing of a test.

  • Listeners : These give the results of the Test Plan execution. These can be added under the Test Plan or under Thread Group. JMeter provides the results in many formats such as Tree, Graph, Table, etc. There are so many Listeners available in JMeter.

  1. View Results Tree

  2. Aggregate Report

  3. View Results in Table

  4. Aggregate Graph

  5. Graph Results

  6. Monitor Results

  7. Summary Report

  8. BeanShell Listener

  9. Simple Data Writer

  10. Backend Listener and more.

Steps involved in converting REST API into JMeter script using HTTPRequest

o Step 1: Define the Number of Threads (Users)

§ User is called a Thread in JMeter. Here we define the count of virtual users to simulate the real users.

o Step 2: Send the Request (Sampler)

§ Request is called a Sampler in JMeter. Here we define the type of request. It can be HTTP Request, Java Request, Junit Request and etc.

o Step 3: Verify the Server’s responsiveness (Listener)

§ Here we add Listeners to check whether the server responds back to the request sent.

o Step 4: Verify the Status Code (Assertion)

§ Here we assert whether the Status Code is correct or not.

How to convert REST API into JMeter script using HTTPRequest?

Step 1: To create a Thread Group

Right click on Test Plan -> Add -> Threads(Users) -> Thread Group

Step 2: To Run with 3 users for validation

Change the No. of Threads (Users) into 3 to run the script for 3 users.

Step 3: To create a Sampler

Right-click on Thread Group -> Add -> Sampler -> HTTPRequest

Here endpoint is

Step 4: To add HTTPRequest details

By default, JMeter considers HTTP requests. Here we are going to get all Programs from the below URL.

The endpoint is

Enter the name : Get all Programs

Protocol : https

Server Name or IP :

HTTP Request : GET

Path : /lms/allPrograms

Step 5: To add Listeners to verify the server is responding

By default, JMeter considers HTTP requests. Here we are going to get all Programs from the below URL.

Right-click on Thread Group -> Add -> Listener -> View Results Tree

We can see View Results Tree to view the results.

Step 6: To add Assertions to verify the server is responding

The server will send the response code as 200 if the request is a success.

· Right click on Get All Programs -> Add -> Assertions ->Response Assertion

· Select Response Code

· Click on Add

· Enter 200

Step 7: Click on View Results Tree

Step 8: Click on the Green Run button to run the JMeter script

Step 9: We can save the test scripts in our local folder. Click on Yes.

Here the filename is saved as GetAllPrograms.jmx.

Step 10: We can see green color tick marks in the View Results Tree for 3 users.

Step 11: Verify the Response code in the View Results Tree.

Step 12: Verify the Response data in the View Results Tree.


Performance Testing is used to determine how the application behaves under different workloads. In this blog, we covered how to download Apache JMeter, and how to convert a simple REST API into JMeter script using HTTP Request.

41 views0 comments

Recent Posts

See All
bottom of page