Is there a way to abort processing a sampler (HTTP Request) when any of the pre-processors execution is failed?
Scenario:
I have tried following within a try-catch block of the JSR223 Pre-processor.
try {
//JSON playload creating script
}catch(anything){
ctx.setRestartNextLoop(true);
}
This does not abort the execution of the current sampler. Processing JSON payload outside the samplers may not be an elegant solution.
The correct function is:
ctx.setTestLogicalAction(org.apache.jmeter.threads.JMeterContext.TestLogicalAction.START_NEXT_ITERATION_OF_CURRENT_LOOP)
However it won't prevent execution of the current sampler, it will not run the next sampler so it makes sense to generate the request body in the JSR223 PostProcessor of the previous request
A more readable solution which will be easier understood by your colleagues would be generating the body in the JSR223 Sampler and conditionally running the HTTP Request sampler via If Controller