Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jmeter how to override csv file of View result tree?

Tags:

csv

jmeter

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?

like image 517
francisco Avatar asked Oct 22 '25 19:10

francisco


2 Answers

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

like image 197
prat22 Avatar answered Oct 25 '25 09:10

prat22


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 now
  • resultcollector.action_if_file_exists=APPEND - new results will be added to the existing file
  • resultcollector.action_if_file_exists=DELETE - the existing file will be overwritten with the new results

Just add the line which corresponds your expectations to user.properties file and restart JMeter to pick up the change.

More information:

  • JMeter Properties Reference - Miscellaneous configuration
  • Configuring JMeter
  • Apache JMeter Properties Customization Guide

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

like image 30
Dmitri T Avatar answered Oct 25 '25 10:10

Dmitri T