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...
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
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.
Related
could find a precise answer to my question.
I have multiple Threads groups on my Test Plan, in all of them I created a CSV file to read a list of cars, for example:
Thread group 1 cars_thread_1.csv
Thread group 2 cars_thread_2.csv
Thread group 3 cars_thread_3.csv
But the list of cars didn't change inside the CSV files.
What's the recommended approach? Keep it like that or I can create a single CSV cars.csv and all of the threads read it?
Sure you can, just place it at the same level as Thread Groups so all of them would be in the CSV Data Set Config's scope
By default each thread will read next line from the file on each iteration, if this behaviour is not something you're looking for - you can amend Sharing Mode setting of the CSV Data Set Config.
I have set 4 virtual user on thread group and i have set csv file config having 2 rows of data.when i run the test the first iteration 2 virtual user is fetching data sequentially but in the next iteration the remaining 2 virtual user is fetching ramdom data not sequentially.I want to fetch data sequentially on the next iteration (1 user->first row,2 user->second row) next itetation(3user->first row,4user->second row) how can i achieve that?
I don't think you can achieve this using CSV Data Set Config as in case of concurrency you might run into the situation when pre-allocated entry for the user will be not sequential when it comes to test results.
If you want to have the following sequence:
line 1
line 2
line 1
line 2
no matter how many users/iterations you have and what is response times fluctuation you need to consider switching to __StringFromFile() or __CSVRead() functions instead of CSV Data Set Config
Using ${path} in the 'Paths:' and providing the CSV file location in the 'Filename' under CSV Data Set Config, I am able to get a single user accessing the URL's one after the other from the CSV file.
But to complete my test, I want to get 1000 users access 1000 URL's concurrently to demonstrate the maximum load on a Database server. Please advice.
I am on Jmeter5.0
Define CSV Data Set Config with (default) Sharing mode All threads -
(the default) the file is shared between all the threads.
In same hierarchy of the sampler
Define in Thread Group Number of Threads: 1000
And execute test while each thread get different line/values from CSV
If you want to have "bursty load":
Set "Number of Threads" under your Thread Group to 1000
Add Synchronizing Timer as a child of your HTTP Request sampler and set "Number of Simultaneous Users to Group by" to 1000
So your test plan would look like:
It will execute 1000 requests at exactly the same moment and stop
If you want "prolonged load" - just let your Thread Group to iterate "Forever". You can limit test duration using "Scheduler" input:
It will execute requests with 1000 virtual users as fast as it can for 10 minutes
How to login multiple users with different input in different threads in Jmeter using CSV data set config?
I have added CSV data set config but the thread is picking only the first entry and i m not able to see the responses for other user login
If you use CSV data set config which contains parameterized values which users(threads) will use while running script.
below is snapshot of jmeter of csv data set config which contain emp.csv file which contains values like,
nachiket,101,test
nikhil,102,test
harish,103,test
which are empname,empid,passwd respectively for 3 users.
if you run test with 3 users then thread1 will pick first and 2nd thread will pick 2nd val so on and you can repeat the file if it has less values than no of threads.
You need to provide enough loops/iterations as given one iteration only CSV Data Set Config will read only the first entry.
Try putting the request you want to parametrize under a Loop Controller, set enough loops and see whether it resolves your issue.
See Using CSV DATA SET CONFIG guide for more details.
I have test with 40 Threads and all sharing CSV file with 5000 rows. I wan't all these threads use unique row during test no duplication. My Current flow is like this..
Test Plan
CSV Data Set Config (All theads)
OnlineQuote(Thread Group with 40 threads)
Transaction Controller
Submit Transaction (Get data from CSV)
If you are OK to stop test when data set if completely used, just set:
Recycle on EOF = false
Stop thread on EOF = false