Search code examples
jenkinsjmeterjenkins-pluginsjmeter-plugins

Is there a way for JMeter to keep a log of the last 500 requests and responses sent?


When you run JMeter in GUI mode and add a listener, you get a view of each request and response. This is lost when using non-GUI mode and instead you get a different output that instead summarizes the number of requests being sent and what percent of them passed/failed:

This is good, however I would also like to get a log of the requests and responses, since that is useful debugging info for the software I'm testing. There must be a simple way to do this?

Also, I plan on running these tests for relatively long durations (e.g. up 3 days, since they are stability tests) and I don't necessarily need all the request/response info. Is it possible to store, say, the last 500 requests/responses?


Solution

  • It is possible to configure JMeter to save request/response data in the .jtl results file by manipulating Results file configuration, example setup:

    jmeter.save.saveservice.output_format=xml
    jmeter.save.saveservice.response_data=true
    jmeter.save.saveservice.samplerData=true
    jmeter.save.saveservice.requestHeaders=true
    jmeter.save.saveservice.responseHeaders=true
    jmeter.save.saveservice.url=true
    

    Alternatively you can add a listener like Simple Data Writer or Flexible File Writer and choose what, when and where to store.

    "Simple" configuration option to save last X requests/responses is not available, if the above solution doesn't fit your needs you can consider implementing your own i.e. JSR223 Listener connected with Counter so you will store request and response data into separate 500 files which will be overwritten when the counter resets