Save body request in JMeter

后端 未结 3 1022
慢半拍i
慢半拍i 2021-01-28 18:58

I am using CSV file which contains variables for my XML requests. I know how to see the request sent, but I would like to save each request in

相关标签:
3条回答
  • 2021-01-28 19:37

    Add > Listers> View Result Tree In result tree click on config button and check the type of data thats has to be stored and provide the link to csv file. Check the snapshot for more info.

    Hope this helps.

    0 讨论(0)
  • 2021-01-28 19:43

    The easiest way seems to be using Flexible File Writer, you can save requestData into a file.

    If you need more flexibility - for HTTP Request samplers you can do it with Beanshell Listener like:

    1. Add Beanshell Listener to your Test Plan
    2. Put the following code into the Listener's "Script" area

      import org.apache.commons.io.FileUtils;
      
      String data = ctx.getCurrentSampler().getArguments().getArgument(0).getValue();
      int threadNum = ctx.getThreadNum();
      int loop = ctx.getVariables().getIteration();
      
      FileUtils.writeStringToFile(new File("request-" + threadNum + "-" + loop + ".txt"),data);
      

    You'll get files like request-x-y.txt generated in JMeter's "bin" folder where:

    • x - JMeter Thread Number
    • y - Current Loop Iteration (Thread Group level)

    See How to Use BeanShell: JMeter's Favorite Built-in Component article for more information on using Beanshell in JMeter tests.

    0 讨论(0)
  • 2021-01-28 19:43

    you should save the results as XML and turn on only the "Save Sampler Data (XML)"

    0 讨论(0)
提交回复
热议问题