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?
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: