0
votes

one thread group:

  • Number of Threads Users: 5
  • Loop Count: 2

5 data prepared in CSV file as following:

  • Customer,ID
  • A,1
  • B,2
  • C,3
  • D,4
  • E,5

Get variable using ${Customer}, ${ID}

for round 1 maybe JMeter get data as following:

  • User1-> A,1
  • User2-> B,2
  • User3-> C,3
  • User4-> D,4
  • User5-> E,5

My Issues: Because maybe User4 of round1 is faster, then User4 will get A,1 for round2, but currently User1 of round1 has not been completed. So User4 and User1 used the same data A,1.

I need avoid different users use one line data.

I tried using ${_V(Customer${__threadNum})} to get specific line by thread number, it returns Customer_1, can not used to get data from CSV. It used for array.

1

1 Answers

0
votes

The only way I can think of is sticking the current thread (virtual user) number with the line of CSV file via __groovy() function, something like:

  • Instead of ${Customer}

    ${__groovy(new File('test.csv').readLines().get(ctx.getThreadNum()).split('\,')[0],)}
    
  • Instead of ${ID}

    ${__groovy(new File('test.csv').readLines().get(ctx.getThreadNum()).split('\,')[1],)}
    

More information: Apache Groovy - Why and How You Should Use It