Search code examples
while-loopjmeterresponse

How to stop a test after finding specific word in jmeter response?


How can we stop a jmeter test after finding a specific word from json response:

{"code":12345,"data":{"mylist":[{"myid":111,"secId":2,"TypeId":1,"name":"one two three" ,"description":"thats the value"}]}


Solution

    1. Put your request under the While Controller

    2. Use the following __jexl3() function as the condition:

      ${__jexl3("${value}" != "thats the value",)}
      
    3. Add JSON Extractor as the child of the request and configure it as follows:

      • Names of created variables: value
      • JSON Path Expressions: $.data.mylist[0].description
    4. That's it, the While Controller will loop until "description" fields becomes thats the value

    Demo:

    enter image description here