developer monkeys
developer monkeys

Reputation: 44

Jmeter How to use different user variables for each thread (each thread. not thread group)

I want to use 100 concurrent users in one thread group in Jmeter. but I want to each thread to use different user login password. how to achieve that?

Upvotes: 1

Views: 3206

Answers (2)

Dmitri T
Dmitri T

Reputation: 168002

There are multiple options depending on where do you want to keep the credentials.

  • The most commonly used approach is storing login/password combinations in the CSV file and using CSV Data Set Config for reading them. By default each JMeter thread will read the next line from the file on each iteration
  • If your credentials are in the database you can use JDBC PreProcessor
  • If you plan to run your test in Distributed Mode and don't want to worry about copying test data to all slave machines - there are HTTP Simple Table Server and Redis Data Set Config

More information: JMeter Parameterization - The Complete Guide

Upvotes: 0

Rashad Nasirli
Rashad Nasirli

Reputation: 477

full credit to Apache Jmeter documentation:

Some test plans need to use different values for different users/threads. For example, you might want to test a sequence that requires a unique login for each user. This is easy to achieve with the facilities provided by JMeter.

For example:

Create a text file containing the user names and passwords, separated by commas. Put this in the same directory as your test plan. Add a CSV DataSet configuration element to the test plan. Name the variables USER and PASS. Replace the login name with ${USER} and the password with ${PASS} on the appropriate samplers The CSV Data Set element will read a new line for each thread.

UPDATE documentation link

https://jmeter.apache.org/usermanual/best-practices.html

Upvotes: 1

Related Questions