I need to Write to CSV file in JMeter from multiple threads concurrently. Of course, it’ll cause a race condition, so I’m thinking to take the strategy from Jmeter write data into excel sheet from multiple thread groups executing concurrently :
A better solution would be passing values from one group to another using in-memory approach, to wit without any interim files. You can use __setProperty() function to define the property
I.e., I plan to define an array in properties and each thread will append its record to the array, then write such array out once in the end (don’t know how yet as I can’t use a tear down thread).
So,
- When each thread try to append to array in properties, does JMeter provide any concurrency protection, or I need somehow protect it myself?
- What’s the best approach to write the array out once in the end of the test?
>Solution :
- If you want to write some values to JMeter .jtl results file – go for
sample_variablesproperty - If you want to write some values to a separate file – consider using Flexible File Writer plugin. It can be installed using JMeter Plugins Manager.
- In case if above options don’t work for your – you will need to come up with your own Listener.