So, I have a Jmeter jmx file that, I execute by the command line and the result is automatically exported for a CSV file, I have an assertion of type View Result Tree where I defined the CSV. My problem is that if I execute with the GUI the Jmeter ask to override the CSV file that is the behavior that I expected, however executing the Jmeter by the command line the Jmeter don't override the CSV, it appends the results to the existing file. How can I define to override the CSV instead of appending?
Using -n -t and -l command line argument jmeter .csv file can be written. here is the below example:
C:\apache-jmeter-4.0\apache-jmeter-4.0\bin>jmeter -n -t C:\apache-jmeter-4.0\apache-jmeter-4.0\bin\examples\Post_call_24_FirstStep_10.jmx -l C:\apache-jmeter-4.0\apache-jmeter-4.0\bin\examples\CSVDATATest.csv
Try out -f command line argument to remove data from .csv file and then add new data
Try out this here is example:
C:\apache-jmeter-4.0\apache-jmeter-4.0\bin>jmeter -f -n -t C:\apache-jmeter-4.0\apache-jmeter-4.0\bin\examples\Post_call_24_FirstStep_10.jmx -l C:\apache-jmeter-4.0\apache-jmeter-4.0\bin\examples\CSVDATATest.csv
For more information
Full List of CommandLine Option
The GUI mode behavior is controllable by the following JMeter property:
resultcollector.action_if_file_exists
The possible values are:
resultcollector.action_if_file_exists=ASK - what you have nowresultcollector.action_if_file_exists=APPEND - new results will be added to the existing fileresultcollector.action_if_file_exists=DELETE - the existing file will be overwritten with the new resultsJust add the line which corresponds your expectations to user.properties file and restart JMeter to pick up the change.
More information:
Be aware that according to JMeter Best Practices it is not recommended to run JMeter in GUI mode and use listeners, especially the View Results Tree
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With