3

I've a JMeter test plan with a number of HTTPRequests. For each HTTPRequest I have added a "Save Responses to a file" Listener when a failure occurs. Ideally I would like the file name to be the same as the label of the Request it is logging it for with a suffix "_FAILURE" added.

Is there any way of using a single "Save Responses to a file" Listener at the top level of my plan and having this be generated automatically rather than having to set manually myself for each?

Paddy
  • 523
  • 1
  • 6
  • 29

1 Answers1

2

Any listener has access to SampleResult of sampler that was run last. You can get it using __Beanshell function. SampleResult has method for getting sampler label. So filename prefix of Save Responses to File listener will be:

${__BeanShell(SampleResult.getSampleLabel())}_FAILURE
Andrei Botalov
  • 20,686
  • 11
  • 89
  • 123