jMeter how to re-execute CSV Data Set Config - jmeter

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)

Related

Need to save multiple Correlated value to CSV or Txt file using JMeter plugin HTTP Simple Table Server

Txt file is showing empty when i am trying to save Correlated value to CSV or Txt file using JMeter plugin HTTP Simple Table Server?
please find the steps i did
Step 1: File initialization kept in setUp Thread Group
Initialization
Step 2: correlated value is in Ultimate thread group, so i have placed adding in thread group end
using below help
POST : http://hostname:port/sts/ADD
POST Parameters : FILENAME=file.txt,LINE=D0001123,ADD_MODE=[FIRST,LAST],UNIQUE=[FALSE,TRUE]
For Adding using
not throwing any errors but file is showing empty
I believe you need to call SAVE endpoint in order to flush the dataset to the file
You may find approach with Flexible File Writer and Sample Variables easier to use

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

Proper way to save Jmeter Results to csv - how to finalize results file

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

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.

Running A Large List of Files Once and Only Once in JMeter (Possibly in a Particular Order)

I'm trying to run around 15000 soap requests through JMeter. I have 15000 individual soap files in a folder.
I know that the WebService(SOAP) Request component has the option to point to a folder.
But, the problem is that the files in the folder will get picked up and run randomly and a file can get run multiple times.
This is not ideal because each request has a unique correlation id and if a file get's run twice, the second run will fail due to a duplicated correlation id.
Is there anyway, I could tell jmeter to run the files only once?
Also, as certain soap requests are dependent upon other request having already run, the ability to run these in a specified order would be desirable. Is this possible?
These seem like common problems that should have already been solved. But, I can't find much on google.
Do you guys have any ideas?
I would use the JSR223 Sampler to run a script (e.g. Groovy) to iterate through the files in the directory and store the text of each file in a String.
See, for example, this other answer about using a Groovy script to iterate a list of values.
You could put the data into a csv file and read it in using a CSV Data Set Config. If you need unique values over multiple threads then you have to create multiple files, one per thread.
You could also put the data in a database and use a JDBC Config/Sampler to access it, making sure to either a: delete the data after it is read, or b: mark it as 'read' using a flag. Both methods would prevent the same record being read twice by different threads.
If you need to run requests in order you should structure the test plan as such, requests will be made sequentially, top to bottom.

Resources