Search code examples
jmeterperformance-testingexport-to-csv

How to save request body in Jmeter?


I am fetching data from the CSV file and giving as input to my Request.How can I save all the request in the same file when I run a test for an hour.

One more requirement is, if the result is success then I have to write that data I have used from the CSV into another file so that we can have only the data which is working in an separate file.

Please suggest


Solution

  • The best way would be using JMeter's built-in Sample Variables property.

    1. Add the next line to user.properties file:

      sample_variables=foo

    2. Replace foo with the variable name you're getting from the CSV file

    3. Next time you run your JMeter test in command-line non-GUI mode like:

      jmeter -n -t test.jmx -l result.csv
      

      your result.csv file will have an extra column called foo and having the foo variable value for each and every request. You will be also able to determine which data caused the failure by looking into "success" column

      JMeter Result File Sample Variables