JMeter - A Thread should read the same value from a csv file for every iteration

45 views
Skip to first unread message

Ajith R

unread,
Jun 19, 2024, 2:43:27 AMJun 19
to JMeter Forum
Hi Team,

I have a JMX file, where parameterization is done via CSV Data Set Config.

The CSV file consists of 4 rows. Number of Threads under Thread properties are 4.

Now, the 1st thread should pick up the 1st row of data, 2nd thread should pick up the 2nd row and so on.. irrespective of the number of iterations.

Could you please help me with this?

Thanks for your support.

Regards,
Ajith

DT

unread,
Jun 19, 2024, 1:15:54 PMJun 19
to JMeter Forum
The options are in:

  • if the data is not separated by comma or other delimiter you can use __groovy() function to read the line based on the thread number, something like: ${__groovy(new File('test.csv').readLines().get(ctx.getThreadNum()),)}
  • there is also __CSVRead() function when you choose when to switch to the next line
  • and last but not the least there is Extended-csv-dataset-config plugin where you can pre-allocate a block of values to each thread
Reply all
Reply to author
Forward
0 new messages