简体   繁体   中英

JMeter CSV data set split into threads (users)

What I want to do:

I would like to test behavior of the system for 50 users. Each user has to do the same action X times, with different input ( X - depends on how many records I have in the CSV file, so if the file contains 1000 records, each user will do the action 20 times).

What I actually did to do that:

I set up CSV Data Set Config (with CSV file with 1000 lines) and ofc set up Number of Threads to 50

What is my problem:

Now I'm quite not sure how to share the CSV file so that all user will have unique poll of the lines from the file. (so each user will have his unique lines from the CSV)

What can I do to workaround:

I can copy thread groups to make 50 thread groups, and add them separated CSV files, but it sounds ridiculous...

In thread group under thread properties, we can set

number of threads = 50
ramp up period = 1
loop count = 20

So, here each thread after a sec will take next line from csv file and execute it. This way the same csv file will be shared among different threads.

在此处输入图片说明

I would recommend to create multiple CSV files for your test plan and assign the variables accordingly for smooth execution of the script. Using same CSV file can not solve the problem as there are times when few threads executing much faster and others are slow in that case action will start replicating between different threads.

Given you set the following values in the CSV Data Set Config

  • Recycle on EOF: False
  • Stop thread on EOF: True
  • Sharing mode: All threads

    在此处输入图片说明

then each thread (virtual user) will fetch new value(s) from the CSV file which will guarantee uniqueness of the test data

You can check this yourself by using __threadNum() function and ${__jm__Thread Group__idx}; variable

在此处输入图片说明

More information: CSV Data Set Config in Sharing Mode - Made Easy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM