0
votes

I am new to jmeter. I want to loop an api based on a condition. In the while controller I added the script as ${__javaScript("${response}"=="Please, wait while your order is being processed.")}

I added the http request sampler under this controller. The response I am getting from this request is

{"resp":"Please, wait while your order is being processed."}

I want to hit this api until I get this value in response.

I used regular expression extractor and provided the expression as "resp": "(.+?)" . But I am not getting this result and my loop is running continuosly. Please help

1

1 Answers

0
votes

It might be due to an extra space in your Regular Expression, looking into the response:

{"resp":"Please, wait while your order is being processed."}

There is no space between the semicolon and quotation mark, and in your regex:

"resp": "(.+?)"
       ^ here is the space character

Given regular expressions could be very fragile when it comes to working with JSON data I would recommend using one of the following Test Elements:

In both cases the relevant JSON Path query will look like:

$.resp 

References: