Load Testing and API Testing Using APACHE JMeter

J-meter is an open-source tool that we can use to measure the performance of the web application. Both load and stress testing come under performance testing.

Load testing: How many users can access the system/service simultaneously.

Stress testing: There is a maximum load capacity. If the load goes beyond that, it shows errors, and sometimes system breaks or getting slow. We must identify that capacity.

So if the system can handle a large number of users concurrently, the performance is really good.

Just imagine, you need to test the performance of your website for 1000 users. But you can’t arrange 1000 users with required resources (PC, Internet, etc) simultaneously to test the performance. You need a tool to test the requirement.

There are a number of features in JMeter.Such as open-source, friendly GUI, visualize test results in different forms, higher testing capacity, and platform-independent.

API testing can be done using J-Meter too. So in this article, I’m going to explain both performance/Load and API Testings with demo videos.

Load Testing

There are a few basic components you should need to identify in J-meter.

1.Thread Group: It’s a collection of threads and each thread simulates 1 real user. If you want to test your website using 1000 users, you have to add 1000 threads. I added 100 threads for my performance/load test. (You can add the thread group by right-clicking the Test plan)

In this UI, the Ramp-up period is the delay between users who are trying to access the service, and the loop count is, how many times it executes.

Image 1


J-Meter supports different types of protocols such as HTTP, HTTPS, FTP, etc. In sampler, you can add which type of request you are going to test.

Image 2

You can add your server name in the mentioned section and I’m testing the performance of google server now. Because I’m going to compare google and yahoo in my demo video.

Let’s say, your site is, “www.travelceylon.com” and you need to do a load test for a specific article on that site. (“Sigiriya”).

In this case, you can add your site in the server name section and add the path to your article in the path field. (eg: /Sigiriya)


It shows the results of testing in different forms. I’m using graph result to check the performance of www.google.com

Image 3

So that’s all to do. Now you can run the test. It’s good to save it and run.

The important factors are deviation and throughput. The deviation should be lower and the throughput should be higher if the performance is good. Throughput means the number of requests it can handle in a minute.

Check the videos I have added below and compare the 2 servers. (Google and Yahoo)

Then you can get a good understanding

Here you can see the performance is higher in google than yahoo comparing the throughput value. These values can be changed when you are doing this test since the internet speed, Processer speed, and many factors affect this. Simply this is how we do load testing. You can try changing the number of threads, loop count, and ramp-up period.

API Testing

There are many tools to do API testing, J-Meter is one of them. I” ll explain briefly how we can do an API Test using J-Meter.

You can clearly understand it by watching the demo video as well.

Here also we use the same components that I have explained in load testing.

Initially add the request type, endpoint, path, and the parameters here. I use the endpoint api.openweathermap.org for this testing.

And this is my example API call api.openweathermap.org/data/2.5/weather?q=London,uk&APPID=349d0d881c2f570fadcaecba4c15f050.

Server: api.openweathermap.org

Path: /data/2.5/weather

Parameters: q=London,uk&APPID=349d0d881c2f570fadcaecba4c15f050.

Remember, you have to generate a new API Key (APPID) if you practice API testing using the above-mentioned service. After sign up, you will get a mail including all details.

You can view the sampler UI below.

Image 4

In API testing, better we use the “view from tree” format to see the results.

After adding the results format, you can run the test. (Don’t think about the response assertion component. we don’t need that at this moment)

Take a look at the screenshots below.

Image 5
Image 6

In the response body, you can test everything. If you want to see it clearly, you can copy-paste this response into an online JSON parser.

Another important point is, here you can see the response code is 200.

We can test if we get the required response code in API. For that purpose, we have to add a response assertion.

Image 7

Enter the required code and then you can run the test again. If the response doesn’t have such code, it shows an error.

Please go through the below demonstration for a better understanding.

Hope I was able to help someone out there.

I’m not an expert. I just share with you what I learned. Do some more research on this tool if you are interested since it has many more features.

Let me know your comments/suggestions.


Resources: https://jmeter.apache.org/usermanual/index.html

Quality Engineer | Blogger | Tech Enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store