Multiple User Login Using JMeter
Jmeter

Multiple User Login Using JMeter

Problem

You want to simulate a realistic load test where every user is having a unique user session. You application may only accept one user login per account at a time. You want each concurrent user to pick a different login password.

It’s way more realistic to simulate concurrent users using unique logins and passwords because it’s closer to the real world load. It’s a good practice to avoid using a single user login and password for all concurrent users. Typically, web servers create web sessions per account. Using a single account for multiple users can mess up things on server side pretty quickly.

Solution

JMeter provides a facility to manage login and password: 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. This is fairly straightforward, I’m going to explain how:

  • First, create a csv file containing a couple of logins and passwords. Example: CSVSample_user.csv.
jsmith,passw0rd
jdoe,secret
  • Then, in JMeter create a CSV Dataset Config under the Thread Group,
  • Configure CSV Dataset in All Threads sharing mode to ensure each thread is picking a new csv line,
  • Finally, create an HTTP Sampler and ${USERNAME} as username, and ${PASSWORD} as password.

The screenshot below shows the example configuration in JMeter.

JMeter CSV Dataset Config

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.

By - CTO.
Tags: Design Variable Csv