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

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.

Related

Jmeter How to use different user variables for each thread (each thread. not thread group)

I want to use 100 concurrent users in one thread group in Jmeter. but I want to each thread to use different user login password. how to achieve that?
full credit to Apache Jmeter documentation:
Some test plans need to use different values for different users/threads. For example, you might want to test a sequence that requires a unique login for each user. This is easy to achieve with the facilities provided by JMeter.
For example:
Create a text file containing the user names and passwords, separated by commas. Put this in the same directory as your test plan.
Add a CSV DataSet configuration element to the test plan. Name the variables USER and PASS.
Replace the login name with ${USER} and the password with ${PASS} on the appropriate samplers
The CSV Data Set element will read a new line for each thread.
UPDATE documentation link
https://jmeter.apache.org/usermanual/best-practices.html
There are multiple options depending on where do you want to keep the credentials.
The most commonly used approach is storing login/password combinations in the CSV file and using CSV Data Set Config for reading them. By default each JMeter thread will read the next line from the file on each iteration
If your credentials are in the database you can use JDBC PreProcessor
If you plan to run your test in Distributed Mode and don't want to worry about copying test data to all slave machines - there are HTTP Simple Table Server and Redis Data Set Config
More information: JMeter Parameterization - The Complete Guide

how to run all the API's in thread which will fetch the first value from CSV after one iteration it should fetch the second value from csv

I have a script which has Login API which fetch the first values from CSV file after other API's run which should run with the same user, after running all the API in thread again it should fetch the second value from csv.
I have done with the entire setup but while running the script it's randomly fetch the value from csv
assuming you are using multiple Thread Group. if yes then look for sharing mode in CSV Data Set Config. link with help you to understand sharing mode
https://www.blazemeter.com/blog/csv-data-set-config-in-sharing-mode-made-easy
For Single Thread Group use sharing mode as Current thread in CSV Data Set Config

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.

Loop Controler in jmeter with multiple users

I have scenario,the steps mentioned below:-
Step#1. Login to the application
Step#2. Upload an excel file (It will display all the uploaded records in the page)
Step#3. Need to click on each record one by one(Assuming that each file has 10 records)
NOTE:- Need to exceute the above steps with multiple users.
I have created a test plan as below:-
1.Login
2.Upload file(With CSV config which has upload file info)
3.Loop control(iterates 10 times,with CSV config which has record details,for clicking)
3.1.click on record
The problem am facing is,when i execute the above testplan with 10 users ,at any point of time only 1 user is exceuting in the loop control.
Is there anything am missing here..
regards.
Could you be more clear in regards to expected results and share your CSV Data Set Config details? I'm particularly interested in Sharing Mode setting.
As per Using CSV DATA SET CONFIG guide
It is worth mentioning that every CSV Data Set Config is visible to all Thread Groups by default. If you need to use separate CSV Data Set Config for every Thread, you create a number of data files that you need and in every CSV Data Set Config set “Sharing mode” to “Current Thread”

How to set up a large amount of request data for a jMeter load test

I want to simulate a few hundred http request each with a different token and userId which I have in a database table.
What's the best way of setting up a jMeter load test to do this?
You can use JDBC Sampler to extract you data from DB to create a CSV and a JSR223 Sampler using groovy (add groovy-all.jar in jmeter/lib folder) to write the extracted values to a CSV file.
Then in the real plan , use CSV DataSet Config using the generated file.
Depending on how you want to use the dataset, you will play with Sharing mode attribute.
If you want to do both steps within the same plan you can use a Setup thread Group that will contain the JDBC Sampler part to write the CSV File, this will use 1 thread and then
the other part in regular Thread Group that will use the number of users you need.
One way is to put all your parameters into a csv file and use CSV Data Set Config in jmeter. Right click on the thread you have created - add- Config Element- CSV Data Set Config. Remember you need to set the Number of Threads(users) to match the number of users in your CSV file.

Resources