One of the common ways to parametrize your performance scripts is to use a CSV file. The best example of CSV input files usage is a login process. If you want to test your application across different users, you need to provide a list of user credentials.
Let’s assume that we have a login request that works for one specific user:
We can easily parametrize that request by using an external CSV file and running the script across different users. To add CSV parametrization config:
Right click on login request -> Add -> Config Element -> CSV Data Set Config
A short explanation of ‘CSV Data Set Config’ parameters:
Let’s create a csv file containing different users with names and passwords:
We can now use this file with the CSV Data Set config. In our case, it’s enough to add the “Filename” and “Variables Names” config values:
The last step we have to take is to parametrize the login request with CSV variables. This can be done by substituting the initial values with appropriate variables from the “Variable Names” configuration field of the CSV Data Set Config, like this: If we run our test script now, JMeter will substitute these variables with values from the ‘TestUsers.csv’ file. Each JMeter virtual user will receive credentials from the following csv file line.
The login request by the first user:
The login request by the second user: