0
votes

I have been assigned with a task to capture the XML data inside a response body of a sampler in Jmeter. I've tried many ways to save the response data but there is no luck.is there any way to save the Response data in xml format using Jmeter? looking for a positive reply.

enter image description here

1

1 Answers

0
votes
  1. Add the next 2 lines to user.properties file (located in JMeter's "bin" folder)

    jmeter.save.saveservice.output_format=xml
    jmeter.save.saveservice.response_data=true
    
  2. Run your JMeter test in command-line non-GUI mode like:

    jmeter -n -t test.jmx -l result.jtl
    
  3. You will be able to see response data for each sampler in result.jtl file.

See Configuring JMeter user manual chapter for more information on JMeter property files and properties


If you need to store the response data of one single sampler only, add JSR223 PostProcessor as a child of this sampler and put the following code into "Script" area:

new File('myFile.xml') << prev.getResponseDataAsString()

Once you execute JMeter test you should see myFile.xml in JMeter's "bin" folder, it will contain response data. Check out Groovy Is the New Black guide to learn about Groovy scripting in JMeter.