0
votes

I have n number of threads for my JMeter test pack . The threads need to pick a value from the parameter (.csv) file and execute for 'x' number of times with the same value . How can I make the threads choose different rows from the .csv file and retain the same for execution.

1

1 Answers

0
votes

If you want to get the following setup:

  • thread 1 always using line 1 from the CSV file
  • thread 2 always using line 2 from the CSV file
  • etc.

the easiest way is using __groovy() function like:

${__groovy(new File('/path/to/your/file.csv').readLines().get(ctx.getThreadNum()),)}

enter image description here

where ctx stands for JMeterContext and ctx.getThreadNum() function returns the number of current thread (virtual user), see Top 8 JMeter Java Classes You Should Be Using with Groovy article for more details on using this and other JMeter API shortcuts