Can I use the same CSV file for multiples Thread groups? - jmeter

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.

Related

Create Jmeter Aggregate report with the thread group name

I need to create an Aggregate report under a thread group with the thread group name. For Ex: If my thread group name is LoginThreadgroup I need to create an Aggregate report file, View Result Tree file name with LoginThreadgroup.jtl LoginThreadgroup_VRT.jtl
I tried to use -${__BeanShell(ctx.getThreadGroup().getName())}.jtl
and
${__threadGroupName}_ViewResultsTree_Failure_report.jtl
ETC but both dint work out well in my case.
I have many thread groups under test tree, for each, I would like to create jtl files with the respective thread group name.
Can anyone help me in this
I don't think you can use JMeter Functions and/or Variables in "Filename" field of a Listener
In general using Listeners is not the best idea as they don't add any value and simply consume CPU, RAM and Disk resources.
I would rather suggest
Adding __threadGroupName() function as a prefix/postfix to your Samplers labels
If you want separate results for different Thread Groups you can use Filter Results Tool to extract Thread-Group-specific entries from the .jtl results file
Aggregate Report can be generated using JMeterPluginsCMD Command Line Tool

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...
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.

Jmeter how to generate threads as per number of columns in a csv file and each thread should pick up data from multiple rows of a specific columns

We are trying to establish no of threads depending on the number of columns present in a csv file, and each thread should pick up data from respective rows of those columns.
can someone help us out in achieving the same.
So from the attached screenshot we would want 6 threads to be established and thread1 should be posting data under user1 itself, thread2 from user2 and so on.
To achieve this you can use CSV Data Set Config
How to set CSV Data Set Config?
Right Click on thread group
Navigate to Add > Config element
Click on CSV Data Set Config
Create one csv or txt file and CSV Data set config as per below attached screenshot.
Whenever you want to user your values, just provide ${user1}, ${user2} and so on.
For more details you can refer CSV Data Set Config from user manual.

how to login multiple users with different input in different threads in Jmeter using CSV data set config

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.

How to read each and every row of csv by single user in JMeter?

I have a CSV file which contains 10 server names. I want to read entire 10 rows by each and every thread of my thread group.
Thread 1 reads row1,row2....row 10
Thread 2 reads row1,row2....row 10
But currently my test script read the file as below,
Thread 1 reads row1
Thread 2 reads row2
Thread 3 reads row3
There are two options:
CSV Data Set Config with Sharing Mode=Current Thread
Variables From CSV File
Read docs and see which one will be better for you.
Use the below function instead of variable:
${__FileToString(/path/to/your/file,,)}
You don't need to use the CSV reader as you want entire file content to be stored in a variable. The below image explains how the entire file content is passed as a parameter value to the HttpRequest.

Resources