DeepakVerma
DeepakVerma

Reputation: 421

In Jmeter how to read/use individual CSV for each user

I have two API one is to Authorise and second API is to create transaction. when user authorised an access token generated. then we pass the generated token and username to create transaction.

I want this functional test to automate with JMeter. So for this I have user.csv file that contains username and password and another two CSV as CreateTransaction1.csv, CreateTransaction2.csv where these two CSV contains records. So, I want user1 to read CreateTransaction1.csv and user2 to read CreateTransaction2.csv

Any idea how can i achieve this?

Upvotes: 0

Views: 249

Answers (1)

Dmitri T
Dmitri T

Reputation: 168157

You can use __csvRead() and __threadNum() functions combination like:

${__CSVRead(CreateTransaction${__threadNum}.csv,0)}

Demo:

JMeter CSV Read Function Demo

Check out How to Use JMeter Functions posts series for more information on above and other JMeter functions.

It won't be possible to use CSV Data Set config as it is being initialized before the test starts running therefore you will need to go for the functions.

Upvotes: 1

Related Questions