JMeter Variables And Functions

Hi Testers!!

In this tutorial, you will learn how you can use variables and functions in Jmeter and make your scripts re-usable.

Below are the topics which are covered in this tutorial:

  • Using Variables in JMeter
  • Using JMeter inbuilt functions like threadnum, counter, machineIP etc.

<< PREV   |     NEXT >>


Like any other programming language, you can use variables to store any value and then later make a reference to it anywhere in your program. So, in JMeter, it could be your server name, path, port number or anything which you want to store in a variable and then later use it on many places.

There are many inbuilt functions in JMeter which solves purposes of testing different scenarios.

For example, if you are hitting application on your machine IP rather than any external URL, directly use machine IP function and it would return your IP Address. Function Dialogue is present in the options menu in JMeter and you can see definition and function string from there.

Below is the syntax used for making a call to variable and function in your script.

  • Variable – {varName}. Example – {emailID}
  • Function – {_functionName}. Example – {_counter()}, {_threadNum} etc.