JMeter - multiple user taking unique row from CSV

2019-06-13 19:51发布

I read many answers around regarding this topic, but I couldn't find the right one for me.

Requirements:

  1. I have 2 threads/users
  2. I have two entries in CSV Data Set Config for login.

The number of users will always be the same as the CSV rows.

My test looks like:

Thread Group

  1. Homepage
  2. Loop Controller
  3. ---Login
  4. ------CSV DataSetConfig
  5. [another http call]

If I set number of threads 2 and Loop to 2 I get in Tree:

  • Homepage1
  • Login user1
  • Login user2
  • Homepage2
  • Login user1
  • Login user2

If I set number of threads to 2 and Loop to 1 I get:

  • Homepage1
  • Login user1
  • Homepage2
  • Login user1

If I set number of threads to 1 and Loop to 2 I get:

  • Homepage1
  • Login user1
  • Login user2

I also tried to put the CSV Data set in the thread group before the login call. If I set 2 users to start the flow, always pick the first row from CSV.

What I need:

  • Homepage1
  • Login user1
  • Homepage2
  • Login user2
  • Each user should continue it's flow

I could try to setup two Thread groups with specific user login, but it's not feasible because I want to increased the number of users and it's not maintainable. As an overview, I have 4 flows and 200 users. After I solve this problem I will think about the user variability.

If anybody knows how to do it or can point me to the right info, please do so. Thanks a lot.

2条回答
闹够了就滚
2楼-- · 2019-06-13 20:37

Create your csv like,

homepage1,user1
homepage2,user2

replace above values in your script for homepage and user login and use one line per thread (which is present in csv config)

enter image description here

so each thread will use whole line1 i.e. homepage1,user1 and will run as per your requirement. That should resolve your issue.

查看更多
Viruses.
3楼-- · 2019-06-13 20:39

Just remove your loop controller, and put your csv file at the top of the testplan. Then set a synchronizing timer after the Login statement and set it to the max users.

Now all your users should login with a different value from csv value if there are enough, plus they will all continue at the same time waiting for all to login first.

查看更多
登录 后发表回答