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...

Working with JMeter Listeners

About Listeners Listeners are used for displaying test results in JMeter. Listeners allow system engineers to analyze the responses from the testing system and monetize...

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....

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

Review of Test Design Studio 2.0

While QTP offers greater flexibility to automate testing procedures, the IDE lacks certain professional features. A QTP license is expensive as well. Test Design...

Working with Selenium WebElements

Table of Contents 1. Selenium WebElements 2. WebElement Locators 3. Working With Text Box 4. Working With Buttons 5. Checkboxes and Radio Buttons 6....

How To Find Broken Links with Selenium

What is a broken link? Links are used for navigating between webpages. Users are directed to a web page when they click or type a...

Common Errors with QTP/UFT – Part 1

As the name suggests, this article focuses on the common problems faced during or after QTP/UFT installation. We shall also have a separate article...

OTHER TUTORIALS

How To Convert List To Array in Java

A common scenario faced by programmers is to convert a Java List to an Array. A 'List' is part...
- Advertisement -spot_img