Parameterizing the ESQL parameter

Another common way to parameterize the script is to use the user defined variables and user parameters.

Unlike CSV Data Set Config which can access an external file, user defined variables and user parameters are used when you have less number of test data, because you need to manually insert the test data.

In user defined variables, only one value can be defined for a variable; in user parameters multiple values can be defined for a variable.

In this section, you will learn how to define the user defined variables and user parameters.

You can define variables in the User Define Variables for Test Plan (then the scope is global) or Thread Group or Sampler (then the scope is local).

For example, select Test Plan, and then input the name and value of the variable.

To add the User Parameters, right click on the Thread Group, and then select Add > Pre Processors > User Parameters.

Suppose you have set the number of users to 3. You can define different test data for the 3 users like this.

Now you can replace the initial value with the user defined variables and user parameters in the request.

Take the Select request as an example.