I am using "CSV Dataset config" to read a parameter from the specified CSV file. I have set the "Sharing Mode" as all threads. For that Thread Group, I have specified "Number of Threads" as four (for four users). I have set "Recycle on EOF" as "True" (I tried with "False" too, but no difference).
When I start the test, It ran for just one user, read all the data from the CSV file, completed the test and stopped. For the other three users, it did not run at all. My guess is - because the CSV file was closed once the testing for user 1 completed.
I tried using multiple Thread Groups in the same Test Plan and each Test Group had just one user. Even then it did not work.
The expectation is- the same CSV file can be used for multiple users and across different Test Groups. There must be a way to rewind the CSV file either by JSR223 Post Processor or otherwise.
I cannot reproduce your issue using JMeter 5.2 and it is quite hard to tell anything comprehensive without seeing your Test Plan.
My expectation is that you violated JMeter Scoping Rules somewhere somehow, i.e. you placed CSV Data Set Config inside one Thread Group while it should live at the same level as all Thread Groups
Given
The following CSV file stored as test.csv in JMeter's "bin" folder:
line1
line2
line3
And the following CSV Data Set Config:
2 Thread Groups set up like:
You should see that each virtual user in each Thread Group is reading next line from CSV file on each iteration:
Related
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.
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)
The test scripts on GUI works perfect but not in the non-GUI mode.Image showing Terminal test execution
Explanation:
I have 3 thread groups in the test plan, where the first Thread Group creates 3 .csv files and are expected to feed the data in the CSV files into the second Thread Group.
For few test runs, Non-GUI mode worked great but then, the tests Intermittently like this [Terminal showing test run], doesn't create the CSV files at all and also,
sometimes, third Thread Group doesn't execute at all.
The problem I noticed is:
During the NOn-GUI tests the files are not been creating, so that's the reason the next Thread groups weren't able to pick up and use the variables inside CSV file and also
The second One could be: I'm saving folder and file paths in the
${__setProperty(prop_folder_Path,${File_Path})} and getting the prop.
${__property(prop_folder_Path)} in another Thread Group -> Sometimes this property function Doesn't work and files are saving in /bin Directory
Is there a way to use ${__property(prop_folder_Path)} value in BeanShell POStProcessor ?
I believe whatever works in the GUI should work same in the Non-GUI too, AM I right?
I Just noticed that output files are creating in /bin folderas shown here while running the tests in NOn-GUI
Any suggestions to fix this. Thank you
My expectation is that your ".csv" files creation fails somewhere somehow therefore 2nd thread group is not able to operate due to missing files.
JMeter doesn't have any build-in functionality to write something into the file so I think you implemented some custom logic using i.e. JSR223 Scripting which doesn't work. The reasons could be in:
If you're running JMeter from another folder the .csv files can be created in a different location, try using full paths just in case.
Non-GUI mode tends to be faster than GUI mode so it might be the case of multithreading issue i.e. when multiple threads are trying to write data into the same file concurrently and clash or produce not well-formed data.
In both cases the answer will live in jmeter.log file, check it for any suspicious entries and fix the causes.
In general using files to pass data between thread groups is not the best idea, I would recommend doing it in-memory instead, for example:
In 1st Thread Group use __setProperty() function to convert your data which you store in CSV file into JMeter Properties like:
${__setProperty(foo,bar,)}
In 2nd Thread Group use __P() function to read the data like:
${__P(foo,)}
More information: Knit One Pearl Two: How to Use Variables in Different Thread Groups
I do the same scenario that was already described in other topics not at once: I'm trying to save Jmeter results to database from csv file.
I have an Aggregate Report listener that saves results to csv file, and everything is OK here.
I also added TearDown Thread Group to my scenario that gets strings from this csv file (by CSV DataSet config) and processes it to database. This part also works fine with static CSV.
Two problems here:
Aggregate Report listener is added on the top level of scenario. So, it adds all samplers from TearDown group to results file as well. So, it's like a recursion: if I do teardown until end of result file, I'll never reach the end, as every new iteration adds some new rows.
At the moment when CSV dataset config takes csv file, it's still in memory only and not finalized to disk. So, file is just empty. How to tell Jmeter that it should write the content from memory to a file and close input stream?
Any ideas how to solve it?
I know that I can move Listener into threads, but in this case I have to duplicate it for every thread group. It's always better to have one listener in one place as I can potentially change its settings.
Thanks in advance.
There is a JMeter Property jmeter.save.saveservice.autoflush defaulting to false
# AutoFlush on each line written in XML or CSV output
# Setting this to true will result in less test results data loss in case of Crash
# but with impact on performances, particularly for intensive tests (low or no pauses)
# Since JMeter 2.10, this is false by default
#jmeter.save.saveservice.autoflush=false
You can amend its value by setting it to true so JMeter will write down each single line of results into the file and closing the file once done. It can be done in 2 ways:
Permanent: add the following line to user.properties file (located in JMeter's "bin" folder)
jmeter.save.saveservice.autoflush=true
You will need to restart JMeter to pick the change up
Ad-hoc: pass the property via -J command-line argument
jmeter -Jjmeter.save.saveservice.autoflush=true -n -t .....
I am trying to replay production logs where the User count varies every second. Currently, I am using Jmeter - Ultimate thread group where we can definethe user scenario. Is there a way, we can populate the user details(Number of Users, Initial delay, etc) from a csv file into the ultimate thread group (I may need to fill in for abt an hour).
Thanks,
Praveen
Maybe it's possible by adding a "CSV Data Set Config" to your thread group - although I'm not sure how to loop through the csv values in one table.
But the easier way (as hinted at in the Ultimate Thread Group docs) is to add threads_schedule to your user.properties file. Just add to the last line
threads_schedule=\
spawn(15,1s,1s,1s,1s) \
spawn(40,1s,3s,1s,2s)
You could use a special file you load on jMeter startup, using a -q UTG.properties commandline argument. The backslashes escape the newlines, so it's almost like csv - you could export a csv from excel and do a pretty simple find and replace to add spawn( and )\ to the beginning and end of each line.