Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
How many of you love pizza?
Probably all of us are feeling hungry at the thought of a cheesy jalapeno pizza, aren’t we?
Let’s consider going to Pizza Hut. There, multiple counters are staffed with workers and accepting orders. So, many orders are being processed simultaneously by Pizza Hut.
Similarly, several users are considered to use the application while testing in JMeter. Each user’s request to the server is simulated as a thread group.
At Pizza Hut, each customer will order something, but this order is limited to items from the menu. Thus, the menu card at Pizza Hut sets some defaults from which specific orders are placed.
Similarly, in an application, each thread will process different requests. Some defaults for each request, like the web server’s hostname, database URL, etc., are fixed. These are defined by configuration elements, while the specific requests from each thread are samplers.
A lot is probably going on in your mind, isn’t it?
Don’t worry.
In this article, we’ll get a clear picture of configuration elements and see the different configuration elements in JMeter.
Configuration Elements
In the introduction, we already got a brief idea of configuration elements.
Let's break it into two words to further our understanding of configuration elements.
Thus, configuration elements can be defined as the elements used to give default values while making a request to the server with samplers.
An important point about configuration elements is that they are accessible only inside the branch in which they are.
To understand this, you may consider the example of local variables. As we know, local variables are accessible only inside the scope in which they were declared. Similarly, configuration elements are accessible in the branches in which they were created.
Now that we know what configuration elements are let’s see the different configuration elements in JMeter.
Configuration Elements in JMeter
JMeter provides a number of configuration elements that are used.
Let’s see what some of them are.
CSV Data Set Config
As the name suggests, this configuration element is used to configure a CSV data set. But what does that mean?
Using this configuration element, the data stored in a CSV file is stored in different variables. These variables are then used in samplers.
Now you may be wondering how this is used. To understand this, let us consider an example of testing.
Suppose we are testing an application where we need to log in. We have considered 50 users for testing. All of them have different credentials. So here, instead of recording the script 50 times, we can save the login credentials in a CSV file and use the CSV Data Set Config to set the different credentials in separate variables for testing.
HTTP Cookie Manager and HTTP Cache Manager
These two configuration elements are used to provide the functionalities of cookies and cache, as in a standard web application, to the testing environment.
HTTP Request Default
This configuration element sets the default values for HTTP requests.
Login Config Elements
Login Config elements let us override the username and password in samplers requiring them.
For example, we can simulate the login to any website using this configuration element to set the username and password to the values we defined.
Other Configuration Elements
Some more configuration elements and their uses have been summarized in the table below:
Configuration Element
Use
User-Defined Variables
Create variables with a key-value pair for testing.
Random Variables
To generate random numbers within a specific range.
Counter
Create a counter variable starting from a specified value and increasing with each iteration to a specific value.
JDBC Connection Configuration
They are used with the JDBC request sampler to create JDBC connection settings.
FTP Request Defaults
To create default settings for testing FTP servers.
DNS Cache Manager
They are used while testing applications behind the load balancers.
HTTP Authorization Manager
They are used to test applications with multiple logins for authorization checks.
HTTP Header Manager
It is used to override HTTP request headers.
Java Request Defaults
Used to give the default values for the Java request sampler.
Keystore Configuration
Used to configure the loading of keystores.
LDAP Request Defaults
To create default settings for testing LDAP servers.
LDAP Extended Request Defaults
To create default settings for LDAP extended request samplers.
TCP Sampler Config
To create default settings for TCP samplers.
Adding JMeter Configuration Elements to Test Plan
Adding a coding element to the test plan is similar to adding a thread group.
The steps to add a config element are as follows test plan or thread group is
-> Add -> config Element -> required listener.
With this, we have completed our discussion on configuration elements in JMeter.
Frequently Asked Questions
What are the configuration elements in JMeter?
Configuration elements can be defined as the elements used to give default values while making a request to the server with samplers.
What are samplers in JMeter?
The requests made by each thread while testing is specified by elements in JMeter called samplers.
What are thread groups in JMeter?
Each user’s request to the server is simulated as a thread group.
Where can configuration elements be used?
Configuration elements are accessible only inside the branch in which they are.
Name some configuration elements in JMeter.
Some configuration elements in JMeter are CSV data config, HTTP cookie manager, HTTP cache manager, login config elements, user-defined variables, random variables, counter, DNS cache manager, and keystore configuration.
Conclusion
JMeter has different elements. One of them is configuration elements, which we learned in this article. But what about the other elements?
We must learn about next but from where?
Don’t worry. Coding Ninjas has got you covered.
To have complete knowledge of JMeter, you may read the articles on