I am writing a test that waits for a specific response using while controller. To be more precise, I send a message with jmeter, then that message gets state "sending" and after about 30 seconds it state changes to "received". So using while controller I try to get how much time that message needs to get received.
- So I create "State" variable and give him value "not set yet"
- Set while controllers condition to ${__javaScript("${State}".indexOf("Received") == -1,)}
- Then in while controller I add http request item with that page which should contain received state when it changes
- In http request I add regex extractor which should take all response text with reg expression set to "(.+)" and reference name to "State"
- Add constant timer with 5 sec in http request
When I execute this test, it gets stuck after http request, which is executed in green and nothing happens next, what can be the problem here?
UPDATE ---------------------------------------------------------------------
Siunčiamas=Sending
Tried something different. Changed while controller value to -
${__javaScript("${State}" == "Siunčiamas",)}
and reg expression extractor value to -
class="label-primary label" id="parentSyncState">(Siunčiamas)<
and before while controller I'm giving State variable value "Siunčiamas"
Now it stucks on http request, but I added debug sampler after it, so it keeps repeating every 5 seconds. But it should be looping until regex extractor does not find required value and return default value which is not equal to "Siunčiamas" so while controller fails. Am I not getting something here?