How to add multiple values to custom variables in JMeter?

In JMeter, you can use components such as User Defined Variables or CSV Data Set Config to add multiple values.

Option 1:
Method 1: Utilizing the User Defined Variables component.

  1. Choose the Thread Group or element in the test plan where you want to add custom variables.
  2. Right-click on the selected thread group or element, choose “Add” -> “Config Element” -> “User Defined Variables”.
  3. In the table of the User Defined Variables component, you can add multiple custom variables and their values. Each variable and value should be separated by a semicolon. For example, if the variable name is var1 and the value is value1; and the variable name is var2 and the value is value2, you can add the following content to the table: var1=value1; var2=value2.

Option 2: Utilize the CSV Data Set Config element.

  1. Select the thread group or element where you want to add custom variables in the test plan.
  2. Right-click on the selected thread group or element, select “Add” -> “Config Element” -> “CSV Data Set Config”.
  3. In the table of the CSV Data Set Config component, multiple variables and their values can be added. Each variable and value need to be separated by a comma in the CSV file.
    For example, if there is a CSV file named data.csv with two columns of data: variable names and values, the file path can be set to data.csv and the column numbers for variable names and values can be specified.
    Assuming the variable names are in the first column and the values are in the second column, the variable name column would be set to 1 and the value column would be set to 2.

After adding multiple values using any method, these custom variables can be referenced in other components of the test plan. For example, you can use ${var1} to reference the value of var1 in the parameters of an HTTP request.

bannerAds