Search code examples
jmeterhttp-status-codesretry-logic

How to trigger retry requests on Jmeter5.3


I have updated hc.parameters file with httpclient4.retrycount and httpclient4.request_sent_retry_enabled to true and uncommented hc.parameters in jmeter.properties file. I would like to do retries for failed requests getting 500, do I need to have script to trigger this on 500 status code or having the hc.parameters will trigger retry. Is there a way to check the retry requests from the jmeter log.


Solution

  • You're looking at the wrong place, if you want to retry the request if it gives 500 - put it under the While Controller and use the following __jexl3() function as the condition:

    ${__jexl3("${code}" != "200",)}
    

    enter image description here

    Then extract the request status code into ${code} JMeter Variable using Regular Expression Extractor:

    enter image description here

    This way While Controller will continue running the request until status code becomes 200:

    enter image description here