Config Elements in JMeter

In this JMeter Tutorial, You will learn how to use Configuration Elements in JMeter are, which we generally say as Config elements and why it is used in JMeter. Suppose there is some data which is assigned to a variable, which means that variable contains some value/data.

Advantage of assigning some value/data to a variable is that we can access it later on. So we can say that, configuration element/ Config element help us to assign an access the value from any variable, which has been assigned to a particular value in JMeter.

One more thing to understand is that Configuration element/ Config element is placed only inside the tree node where it has been defined. There are many configuration elements available in JMeter’ which we can see in the screenshot below.

Config Elements in JMeter

For adding config element in JMeter, we need to right click on HTTP Request which is a sampler and then then select Config element and when we move the mouse over Config element, we see large number of Config element in which we select one, depending upon our requirements as shown in the screenshot above.

Let us understand some of the most commonly used config elements in JMeter.

CSV Data Set Config

Now we should understand that. CSV Data Set Config element is used to read data from. CSV file or text notepad. Let us understand it with scenario. Suppose we are doing performance testing with load of 100 users.

Only thing we are required to give is filename and variable name. Filename will be the name of the Excel file which will be kept at the location where JMeter has been installed and variable name will be: name for which data would be there in the Excel sheet.

For example, if you are to enter the value of username and password in the CSV file, then variable name will be username and password separated by comma. You can see the same in the screenshot given below.

Config Elements in JMeter - CSV Data Set Config

HTTP Request Defaults

HTTP Request Default Configuration elements helper is used to set default values which we use in HTTP request sampler.

Let us make it more clear from example. Let us consider a scenario where we are required to send 50 HTTP is request to the web server, then what generally happens is that we need to create 50 HTTP requests separately, but when we are using HTTP request default configuration element, we are using same server at one time and after giving server name or IP in http request defaults, all the samplers or request will be sent to the same server and we need not give server name or IP to each request or samplers separately.

One thing to be kept in mind here is that we have to create config element HTTP Request Defaults just under thread group so that all other samplers can be added under that config element and all the samplers will be using server name or IP, which has been defined inside  HTTP Request Defaults config element.

We can see how this config element which are added under Thread Group in the following screenshot.

Config Elements in JMeter - HTTP Request Defaults

User  Defined Variables

User Defined Variables is very important config element which allows us to define the number of user-defined variables at one place which can be used multiple times in other samplers/requests.

If we need to do just user-defined variables by several samplers/requests, we need to define it under thread group. All the samplers which will be added inside the trade group will be able to use this user-defined variables defined inside config element user-defined variables.

Config Elements in JMeter - User Defined Variables

One thing to be noted here is that if there is need to use  user-defined variable inside single sampler only, then we need to define it under that sampler /the quest only.

Otherwise, if you want to use this user-defined variable at multiple places, we can define it at the beginning of the test plan just under thread group. Every sampler has facility to define user-defined variables. We can see the same in the screenshot given below.

Also in the screenshot given below, we can see name value pair where we can define name of user-defined variables under Name column and value of that user-defined variable under Value column.

Config Elements in JMeter - HTTP Request

Now one more thing to be noted here is that after we have defined user defined variables in the config element named User Defined Variables, we can access the variables defined inside user-defined variables by using $ sign before user-defined variable.

We have defined username variable inside the config element User Defined Variables.

Now if we have to access username variable inside sampler/request, we need to use $ sign which we can see in the screenshot given below. We have to use username variable in the sampler path which can be seen below, and the value is taken from config element named the User Defined Variable.

Config Elements in JMeter - User Defined Variable in JMeter

HTTP Cookie Manager

It is very important element , which is used in JMeter and it is used to store cookies from the response coming from the server as a result of the http request sent to the server.

It should be noted that this saved cookies can also be used in another samplers or requests of the test plan. The advantage of using HTTP cookie manager is that it automatically stores cookies in the browser and can be used to send cookies to other sampler/request.

In layman language, we can say that if we are not using cookie manager inside JMeter, all the browsers used by JMeter will behave like cookie less browser. In this tutorial, we saw how much important is the use of config element in JMeter.

Different config element serves different purposes. We should understand the purpose of each config elements and use it accordingly, in our performance testing to get the desired result.

Leave a Comment