I have a JMeter script which makes requests to 5 different endpoints. If there's an error, that thread should be stopped.
However, I would like to retry the request to the 3rd endpoint 3 times before stopping the thread.
Here is what my script looks like:
- Thread Group (with Stop thread selected)
- HTTP Request (1st endpoint)
- HTTP Request (2nd endpoint)
- Transaction Controller
- While Controller
- HTTP Request (3rd endpoint)
- JSR223 PostProcessor (to save the response code in a variable for the while controller to check)
- Counter (to keep track of the retry count)
- HTTP Request (3rd endpoint)
- JSR223 Assertion (to set the result as successful, so the first failed retries don't count)
- While Controller
- HTTP Request (4th endpoint)
- HTTP Request (5th endpoint)
Since I checked option Stop thread under Thread Group, if the first request to the 3rd endpoint fails, the thread stops and no retries are made.
If I check Continue, then the retries to the 3rd endpoint work as intended, but the thread doesn't stop if the requests to the other endpoints fail.
I also tried to add the following Groovy script to the JSR223 PostProcessor, but it didn't work:
if (prev.isStopThread()) {
prev.setStopThread(false)
}
I'd appreciate any help I can get.
Thank you!