Restart Jmeter thread group with same user details

628 Views Asked by At

I'm using jmeter version 5.4.1. My load test script uses csv file which contains a lot of users. I want unique user on each thread but same user on each iteration of thread group as I want to restart thread group when some specific condition occurs with same user. All the solutions I have tried reads the next line from csv file and logins with new user instead of previous one.

The solutions I have tried are:

  1. Select "Same user on each iteration" option in thread group
  2. Use "start next thread loop" option in thread group
  3. I used Flow control action option "start next thread loop" after the condition
  4. I used JSR233 Sampler and added the following line to start new thread group SampleResult.setStartNextThreadLoop(true);

Can anyone please help me with this?

1

There are 1 best solutions below

0
On BEST ANSWER

If you're using CSV Data Set Config - it is not possible, the next value will be taken on the next iteration and there is no way to "reset" it to the specific location, only continue where it left off or start from the beginning.

Consider alternative options of reading the usernames, i.e.:

  • CSVRead() function which will proceed to the next row only when you explicitly call ${__CSVRead(your-file.csv,next)}

  • __groovy() function where you have full control on which line to read, for example:

    • ${__groovy(new File('test.csv').readLines().get(0),)} - read first line
    • ${__groovy(new File('test.csv').readLines().get(1),)} - read second line
    • etc.