Sharing mode in CSV Data Set Config in Http Request - jmeter

In a Http Request, how the values from the CSV file can be shared.
In the Https request I have a variable in 100 places but wanted the different values from CSV to distribute among 100 places having one variable name in the same http request of the thread group.

You cannot achieve this using CSV Data Set Config as it will update the variable value either for each virtual user or for each iteration.
You can consider __CSVRead() function as an alternative, it is pretty easy:
${__CSVRead(test.csv,0)} reads 1st column from test.csv file in "bin" folder of your JMeter installation
${__CSVRead(test.csv,1)} - reads 2nd column
${__CSVRead(test.csv,2)} - reads 3rd column
etc.
${__CSVRead(test.csv,next)} - goes to the next line
Demo:
More information: How to Pick Different CSV Files at JMeter Runtime

Related

how to take data from CSV file without retaking, using multiple threads in jMeter?

I have a CSV file with data, that is dynamic and is changed every test run (it could be 3k or 80+k lines). This data - is uuid, that I extract from CSV and set as a variables to my http requests. HTTP request has DELETE method, so after getting each uuid from CSV file - I can't use it again cause I would have a 404 status code. I've already set up CSV Data Set Config and there is no problems when I do it in 1 thread (Number of Threads (users): 1). But, for proper performance testing I need to run test in multiple threads, i.e. 30 or 50. And the point is - that I don't know how to set up logic to be agile and if I have a CSV file with 50k+ uuids that should be used in one Thread Group that has 30 threads - each thread will take only assigned to him uuids, won't retake them and won't take not assigned to him uuids.
Thanks in advance!
If you're using CSV Data Set Config (and this is what you should be using for 80+k lines file) with default Sharing Mode setting of "All Threads"
each JMeter thread (virtual user) will be taking next line on each iteration which means that each UUID will be used only once no matter how many users are there.
If you additionally set Recycle on EOF to "False" and Stop thread on EOF to "True" your test will be stopped when JMeter reaches the end of the CSV file so no duplicate requests will be sent.

jMeter how to re-execute CSV Data Set Config

Using jMeter to set up a soak / load test that needs to run each request with different data. The structure I currently have is
Thread Group (2 Users, 2 Loops)
- Simple controller
-- Java Sampler (Custom Plugin) to convert CSV Formula data into NewThreadData.csv (as variable)
-- Java Sampler (Custom Plugin) to create directory of files created with NewThreadData.csv merged into a template
-- While Controller Condition - js NewThreadData column not = EOF
--- CSV Data Set Config NewThreadData.csv (Recycle False / Stop of EOF False) - filename passed as variable
--- JMS PUblisher with the FileName a variable using the filename column from within NewThreadData.csv
My problem is the on the second loop, the data is updated in NewThreadData.csv, but the CSV in the while loop never runs again.
Appears that the CSV Data Set Config "knows" it has been run, regardless of the actual CSV data.
Questions
How can I get the CSV Data Set Config to be rerun / re executed in this scenario?
Are there undocumented variables or means of getting the config to reprocess?
Is there a way to spawn a new thread on each iteration rather than reusing the existing thread, as the CSV does execute once for each "User"[thread]. I also tried Stop on EOF : True, but that stopped the second loop.
Aim is to eventually ramp up the user count and the number of loops (changing to forever); with there being about about 100 different combinations of data to be inserted on each loop. The formula I am using has time and thread number to give me data uniqueness along with other data that is dynamically created from a formula. Recycle on EOF is not feasible as I need to regenerate the csv contents on each loop. A super-csv I don't think is feasible to cover the load and soak scenarios.
Thanks in anticipation. Andrew
I don't think it's possible to "reset" the CSV Data Set Config, it's a configuration element hence once it reads the file in its current state it will "stick" to its content.
If you're manipulating file content dynamically I would rather recommend going for __CSVRead() function instead which is evaluated in the runtime just where it's placed therefore it doesn't reserve file and it "rewinds" to the beginning of the file when the last line is read.
More information: How to Pick Different CSV Files at JMeter Runtime
CSV Data Set Config element is executed first and only once even though you have placed it within the while controller. Hence CSV Data Set Config element is not suitable for your requirement.
You could use JSSR223 Pre-processor to work with the dynamic CSV files using a supported programming language/script (Java , Groovy)

Setting up user.properties in jmeter for several load test

I'm setting up a load test for several threads that each one needs a specific token.
How can I outsource it via csv file or other solution?
Screenshot of code:
You can use a csv data set config in jmeter for csv/txt files. Keep data in external csv or text file and use in your jmeter script using csv data set config for your desired threads.
Make sure the number or records in the file should be the same as the number of threads you want to execute.
https://octoperf.com/blog/2018/01/25/jmeter-csv-data-set-config/

Can we segregate data used based on the View Results in tree Listener?

We have used let say 500 different data for the same operation and out of which 250 are failed and other 250 is passed.
Do we have any script or method so that i can modify something in property file and segregate that failed data and write that data in some csv or excel file.
You need to create two View Results tree Listeners, with two separate files.
One with Log/Display Only: field mark as Errors and other as Successes.
This way errors and successes will be segregated.
Check out Sample Variables property. You can store JMeter Variables values for each sample result using simple configuration like:
Add the next line to user.properties file (lives in "bin" folder of your JMeter installation)
sample_variables=foo,bar
Next time when you run a JMeter test you will see 2 new extra columns in .jtl results file, foo and bar which will hold the values for the relevant JMeter variables.
This way you will be able to figure out what data presumably causes failure (if it is connected with the input data).
More information:
Configuring JMeter
Apache JMeter Properties Customization Guide
Results File Configuration

JMeter: response assertion for each line in CSV file

I am learning JMeter and trying to do the following:
0) I only use 1 thread and only 1 loop
1) I have a CSV Data Set Config that loads a file with a bunch of strings (I am required to use CSV Data Set config)
2) I have a http request that responds with a web page. I need to make an assertion to it to verify if every string from the CSV is present on the page
I figured out that JMeter iterates to the next line in CSV file either for each thread or for each thread or loop.
But I only use 1 thread and 1 loop, and I don't want to repeat the whole test plan multiple times to verify if it contains multiple strings (it also does other stuff than this). How do I do this?
The CSV Data Set Config only increments to the next line on the next iteration. If you want access to all(or several) values in the CSV file in the same iteration, you should probably use the __CSVRead() function. Or possibly even the __StringFromFile() function.
If you're just doing this as a one of exercise, you can also put all the values you need to check in 1 CSV line and read them as different columns.
Lastly you can use a while controller to read the next line from CSV Data Set Config as explained here.

Resources