Getting Started with Apache JMeter

Apache JMeter Tutorials

1. Introduction

As a developer, you may have tested the functionality of your code hundreds of times during development. This is known as functional testing. Despite how familiar you are with your product, users will approach it differently and have many different use cases. That’s why you need Non-Functional Testing (NFT).

Performance, Security, Usability, and Reliability are just some of the many NF aspects that can be tested to ensure a better user experience. Apache JMeter is one of the best ‘Open Source and Free Tool’ that you can use for NFT. It can be used to perform Load Testing, Performance Testing, Scalability Testing, and more.

2. Watch Installation Video

3. Download and Install

  • Step 1: Install the latest version of the Java SE Development Kit. Download it here.
  • Step 2: Download the latest JMeter binaries from here.
  • Step 3: Install and launch JMeter as follows:
    • Unzip the downloaded JMeter zip file to the intended install folder.
    • Open the extracted folder and go to \Apache JMeter\apache-jmeter-5.2.1\bin.
    • Run the ‘.bat‘ file and you are good to go.
  • Step 4: Identify the basic components of JMeter.
blank

Now you have a basic idea of JMeter and its components. Let’s try a real-world example for a better understanding. Simply follow these steps to test youtube.com as our website.

4. Creating a Test Plan

Let’s start by creating a New Test Plan for our test.

blank
  1. Start JMeter
  2. Go to File > New and add a Test Plan and give it a name.

5. Adding a Thread Group

This section details setting up a certain number of Threads that will be used for our test. You can do so by following these steps:

  1. Right-click on the newly created Test Plan which will be displayed in the Test Plan Pane.
  2. Click Add > Threads (Users) > click Thread Group
blank

Then you have to add the thread properties by clicking your thread group. You can add the Thread name and thread properties that are suitable for your test. I added data as follows:

blank

Based on my values:

  1. Number of Threads: 100 users being connected to our Server application will be simulated.
  2. Ramp-up Period: The 100 threads will be generated within a period of 10 seconds.
  3. Loop Count: The test will be looped (repeated) 10 times.

Also, you can define thread time and thread start delay if needed. I have not used those features in order to keep this tutorial simple.

6. Adding JMeter Elements

Elements are individual tests that will be executed as part of our Test Plan.

HTTP requests can be added by right-clicking the newly created Thread Group and selecting Add > Config Element > HTTP Request Defaults.

blank

In the HTTP Request Defaults add your website name under Basic > WebServer > Server Name or IP:

blank

7. Making HTTP Requests

You can add an HTTP Request by right-clicking on Thread Group and selecting Add > Sampler > HTTP Request.

blank

JMeter HTTP Request Sampler lets the user send HTTP/HTTPS requests to the webserver that we need to access. If we need to access the trending section on YouTube we can simply add /feed/trending in the path section.

I have not added the path here so that our tests are executed on Youtube.com servers.

blank

8. Graph Result Implementation

To add graphically viewable results just Right-click the newly created Test Plan, select Add > Listener > Graph Results.

blank

9. Run and Get the Results

Firstly, save your work. Now run your tests and obtain the results by clicking the “Run” button on the Menu Bar. The real-time results will be displayed on Graph Results.

blank

The above results show the results for our tests on youtube.com:

  • Red: Shows the Standard Deviation of our results.
  • Black: Signifies the number of sample requests that have been sent to the server.
  • Blue: Represents the average number of samples sent.
  • Green: Represents the throughput of our results. It refers to the total number of requests handled per minute by the server.

Throughput and Deviation are the most important parameters that we can use to analyze our results. If the throughput is high, we can generally assume that the server has performed well, though this is not always the case. On the other hand, if the Deviation is low, we can assume our web application has performed well.

The above graph results show high throughput and low deviation. These results are very good and they are no surprise considering that YouTube is a popular service. It has been highly optimized in terms of both server performance and web application performance.

I recommend that you try JMeter to analyze your web application because of its simple GUI, free open-source nature, support for a variety of server types, and platform-independent nature. It will make your testing process much smoother and more convenient.

Tushar Sharma
Tushar Sharmahttps://www.automationdojos.com
Hi! This is Tushar, the author of 'Automation Dojos'. A passionate IT professional with a big appetite for learning, I enjoy technical content creation and curation. Hope you are having a good time! Don't forget to subscribe and stay in touch. Wishing you happy learning!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

JMETER TUTORIALS

Recent Posts

RELATED POSTS

VBS Part 2 – Fundamentals and Concepts

Having gone through the Introductory part, it is time to look at some crucial fundamentals and concepts. This article is to refresh some of...

Finding Web Elements with Selenium

I'm going to explain in this tutorial about the usage of the findElement and findElements method of Selenium Webdriver on the Chrome web browser....

How To Do Database Testing with JMeter

Introduction In this 'How-To', You will be guided to perform a database load test using JMeter. We will be installing Apache JMeter to perform the...

VBS Part 1 – Introduction and Background

At the upfront, this theoretical article might look boring to most of us but still, it is advisable to know about our scripting friend...

Â

CHECKOUT 'HOW-TOs'

How To Install Oh-My-Posh On Windows PowerShell

Oh-My-Posh is a powerful custom prompt engine for any shell that has the ability to adjust the prompt string...

MORE ON CODEX

MORE IN THIS CATEGORY

Best Practices For Evaluating Automation Tool

With rapidly changing financial conditions, businesses face the tough challenge of optimizing resources to produce maximum results. Choosing the right automation tool for functional...

How To Do API Testing with JMeter

Introduction Application Programming Interface is a very popular term among developers. It is simply a request provider that responds to your request. In other words,...

Common Errors with QTP/UFT – Part 2

Welcome to the second and final part of this series on 'Common Errors for QTP/UFT'! Earlier, we discussed about some of the 'Common QTP/UFT...

How To Use TestNG with Selenium

1. What is TestNG? TestNG is an open-source automated testing framework with flexible and powerful features. It is inspired by JUnit and NUnit but with...

OTHER TUTORIALS

Windows JDK Manager (win-jdk-Manager)

ADjo LABS PROJECT : Simple and lightweight desktop utility with Interactive cmd Interface for easy view, re-point and switching...

Java DecimalFormat Class

- Advertisement -spot_img