This element is used to define the user (thread) specific parameters, although the CSV Data Set Config is an easy and flexible method for parameterization. In JMeter, ‘User Parameters’ preprocessor can be used when you have less number of test data which can be used in a repetitive manner and shared by all the thread. As I mentioned, when you have less number of test data then you can easily insert the values in the User Parameter field and allow threads to share the test data. A set of parameters get reused in case less number of data than the number of threads. User Variables can also be defined in the Test Plan using ‘User Defined Variables‘ but those are not specific to individual threads.
What is the difference between User Parameter, User Defined Variable and CSV Data Set Config?
- User Parameter is a preprocessor whereas CSV Data Set Config and User Defined Variables are Config Elements.
- In User Defined Variables, there is only one value of the variable can be defined whereas, in User Parameters and CSV Data Set Config, multiple values can be defined for a variable.
- Test Data cannot be added via an external file in User Parameters and User Defined Variables whereas CSV Data Set Config use .csv file format as a test data.
- Since there is only one value can be given in User Variables so bulk test data can not be used. The bulk test data can be added manually in User Parameters, but it is time-consuming. Although the primary purpose of the CSV Data Set Config is to access an external file so that bulk test data can be available for the test.
How to add ‘User Parameters’ preprocessor?
Follow the below steps:
- Select the ‘Sampler’ node where you want to add the preprocessor
- Right-click on the node
- Hover the mouse on ‘Add’
- Hover the mouse on ‘Pre Processors’
- Click ‘User Parameters’
What are the input fields of ‘User Parameters’?
‘User Parameters’ has the following inputs:
- Name: To provide the name of the preprocessor
- Comments: To provide arbitrary comments (if any)
- Update Once Per Iteration: If you want to update variables using only one iteration and to make sure the values are updated each time based on the execution of the parent controller, you need to check the “Update Once Per Iteration” checkbox.
- Parameters: In this section variables, number of users and variable’s value are added.
- Name: Declare the name of the variable.
- User_<n>: The variable value used by User_<n> thread where n is thread index.
- Add Variable: Click this button to add a new row.
- Add User: Click this button to add a new column.
- Delete Variable: To delete the row.
- Delete User: To delete the user.
- Up: To shift the row up.
- Down: To shift the row down.