JMeter Performance Test: An Introduction

June 15, 2023 by No Comments

JMeter is a great application for performance testing. JMeter would be an excellent tool to automate Performance Testing.

Today, I will introduce to you this practical application and its components. Let’s get started…

JMeter

Apache JMeter is a Java-only application that’s open source. It was designed to test performance and load behavior. It was used to test static and dynamic resources and dynamic web applications. JMeter files consist of simple XML.

JMeter tests different servers, protocols, and applications. Here are the details:

Web-HTTP,HTTPS(java,nodeJs,PHP,ASP.NET)

SOAP/REST web services

FTP

Database via JDBC

LDAP

TCP

Java Objects

Let’s now take a closer look at JMeter.

JMeter Components

Let me describe each component in detail.

Test Plan

Test plans are the foundation of performance tests using JMeter.

Important Points about the Test Plan

Before running the test, it is advisable to save the test plan.

JMX files are used to save JMeter test plans or files.

You can save different parts of your test plan. You can also hold parts of the test plan as other selections.

The test plan does not save the elements of the Workbench.

Thread Group

Thread This is the same as a script being executed by a user.

Thread group: This is the group of users who will execute the scripts. We will then set the iterations and the ramp-up period.

Click on Test plan —> Thread Group.

Number Threads: This simulates the number of users or connections to your server application.

Ramp-up Period: It is when the number of users will increase. It measures in seconds.

Loop count: This is the number of times a test will run. You can provide iterations for a test based on how many times that particular test runs. The test will continue to run indefinitely. Like until you stop.

Samplers

JMeter can send specific types of requests to servers using samplers. The target server receives a simulated request from a user. An HTTP Request Sampler, for example, can be added if you wish to perform POST, Get, or DELETE operations on an HTTP service.

Samplers can be useful for:

HTTP Request

FTP Request

JDBC Request

Java Request

Request SOAP/XML

RPC Requests

Check out this HTTP Request Sampler control panel:

Logic controllers

You can control the order of Samplers within a Thread using Logic Controllers. They can change the order in which requests arrive from their child elements. Examples include: For Each Controller (for each element), While Controller (for each loop), Loop Controller (for each IF Controller), Run Time Controller (for each run time controller), Interleave Controller (for interleave), Throughput Controller and Run Once Controller.

Check out this Loop Controller Control Panel.

Config Elements

Some config elements can be used to further parameterize requests sent to the server. These are executed before the actual request. CSV Data Set Configuration can be used to read values from a CSV.

Here are a few important configuration elements that you can use to test the performance of web and mobile applications.

CSV Data Set Configuration

HTML Header Manager

HTTPS Cache Manager

HTTPS Cookie Manager

HTTPS Requests by Default

User-defined Variables

CSV Data Set Config

This is an important element of the configuration element. CSV data sets can be used to parameterize. This means we create the CSV file with inputs and then update it in JMeter.

Parameterization

Parameterization is the inputs that are given by a keyboard.

The load test will be run with inputs from different users and data.

Why is it necessary? You can use it to generalize a particular action for many users. Parameterization is useful if a test plan must be executed for multiple users simultaneously. These are the steps that you should take:

Click on the Thread group-> Add->Config element -> CSV data set Config.

Open the bin directory from JMeter’s installation path. Enter values in a text document. Save the file under a name you like and with “.csv.” It can be stored in the Bin Folder.

Enter the file name and parameters in CSV Data Set Configuration.

As shown below, choose the HTTP request in which the CSV parameters should be sent in the “Send Parameters with the Request” value part in the form of “$ user and “$ password.”

You can now run the script to verify the Add > Listener and View result tree results.

You have it!

Regular expression extractor

This means you can find the dynamic values stored in the scripts and transmitted by the server.

Correlation

Handle the dynamic values that are passed by the server. This is the process of capturing, storing, and then passing on the dynamic response received from the server to the subsequent requests.

Regular Expression Extractor

Create Test Plans in JMeter

Add a Regular expression extractor to the Test Plan

Run Validate Test

AfterAfter adding the server name in HTTP Request, you must include the Regular Expression Extractor, you must include the Regular Expression Extractor. This will extract some values from the response of Step 1. Select Post-Processors by right-clicking on the HTTP request. Include Regular expression Extractor.

You must complete four fields to extract a value from the Regular Expression Extraction.

Name the variable created – Select any name.

2. RegularExpression Add any regular expression that you wish to obtain from the Server

3. Template: Add Groups to your Regular Expression

4. Match No. Add as many matches as you like to your Regular Expression

Boundary Extractors

The boundary extractor captures the dynamic value of the response.

Sampler

A sampler is a request. It will send the request to the server.

Debug sampler

Debug sampler helps us to troubleshoot variables in the script. This sampler will help us identify and fix script errors or problems.

Listeners

Listeners are the component that allows us to store and view results in JMeter. The result can be seen in different formats.

View the result tree.

View the result table.

Summary Reports

Report on aggregate data

Images

Leave a Comment

Your email address will not be published. Required fields are marked *