Multiple User Login Using JMeter Parameterization

Mousume Haque
3 min readJan 26, 2020

JMeter an open source software is used to do load and performance testing and analyze the overall performance of dynamic web applications. If you need to load test of a Login Page with different username and passwords then you surely cannot hardcode the values, hence you need to parameterize the value.

Ans also it’s way more realistic to simulate concurrent users using unique logins and passwords because it’s closer to the real world load. In simple words, Parameterization in JMeter is the process where test plans are executed with multiple sets of user Input Data.

JMeter allows you to do parameterization using CSV Dataset Config. By defining a CSV file containing all the login and password couples, JMeter can pick a line from the file on each user iteration and assign them into variables.

Configuring different elements of CSV Data Set Config:

  • FileName : If your file (.csv)is located at /bin then you can just use a FileName(.csv) and if it’s somewhere else, use the full path of file.
  • Variable Names : This will contain all variable names(comma separated) which is equivalent to a “column name” in a csv file in the same order. If this field is kept empty, then JMeter will by default take the 1st row from csv file.
  • Delimiter : It is used to separate each record in csv file. Comma is the default delimiter, but if your file uses tabs, then we need to define that here only.
  • Allow quoted data? : Values can be put under “” (double quotes) which allows values to contain a delimiter, if enabled.
  • Recycle on EOF? : If you plan to iterate over the csv file more than once you must set it true as it instructs JMeter to move back to the top of the CSV file.
  • Stop thread on EOF? : Set it true if you want to stop after reading the whole csv file.
  • Sharing mode :
  1. All threads: File is shared between all the threads.
  2. Current thread group: Each file is opened once for each thread group in which the element appears.
  3. Current thread: Each file is opened separately for each thread.

Step 1: Create a text file and enter values into it. Now save the text file with proper name and “.csv” extension.

userpass.csv

Step 2: Then, in JMeter create a CSV Data Set Config under the Thread Group. Click on “Thread group-> Add->Config Element -> CSV Data Set Config”.

Step 3: Now, open CSV Data Set Config and enter exact Filename and Parameters.

CSV Data Set Config

Step 4: Create an HTTP Sampler under Thread Group and set the value ${USER} for username, and ${PASS} for password. You can choose the Name as your wish but Value should be same as CSV Data Set Config’s Variable Names(Comma Delimiter) with this format: ${variable}.

HTTP Request with parameters

Step 5: Now all you need to do is run the script and verify the result for that. Click on “Thread group->Add > Listener > View Results Tree”.

View Results Tree & Verification

Remember to copy the CSV file to each load generator before running a distributed test. Also, make sure the file is located at the same place on each load generator.

--

--

Mousume Haque

Innovative and professional Software Testing & Quality Assurance Engineer with 8+ years hands on experience in testing of web applications & mobile application.