0

I have a situation where I need to pause all of the threads to a particular endpoint when I receive a specific error code from the response. So I basically need to look for this error code (ex. 404) and pause for a random num of secs b/t 3 and 10. Below is my current test structure. I have looked at the logic controllers but I am unsure how to implement. I assume that I would need to wrap each request with this logic. Thanks for your help!

  • Test Plan
    • Thread Group
      • CSV Data Set Config
      • HTTP Request 1
      • HTTP Request 2
      • Summary Report

Matt

0
  1. Add Regular Expression Extractor as a child of the HTTP Request sampler which code you need to extract and configure it as follows:

    enter image description here

    it will save response code of the sampler into ${code} JMeter Variable

  2. Add If Controller after this sampler and use the following __jexl3() expression:

    ${__jexl3(${code}==404,)}
    

    it means that If Controller's children will only be executed if the Sampler will fail with 404 status code

    enter image description here

  3. Add Flow Control Action sampler as a child of the If Controller and configure it as follows:

    enter image description here

    this ${__Random(3000,8000,)} function will generate random think time between 3000 and 8000 milliseconds which seems to be exactly what you're looking for

2
  • Thanks for the detailed explanation! I followed your steps but I am trying to see if it is actually executing the flow control action. How would I verify this? – M Thurman Jul 29 '20 at 18:47
  • getting an error now: 2020-07-30 15:42:18,025 WARN o.a.j.s.TestAction: Could not parse number: '${_Random(3000,8000,)}' – M Thurman Jul 30 '20 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.