0
votes

I want to post some bulk messages. System takes some time to process them, so i do not want to proceed for 2nd iteration. My setup is something like this While controller->jdbc request->beanshell postprocessor

In While controller, condition is ${__java script("${check_1}" != "0")} check is the variable name as part of database sampler which checks whether all the messages are processed. Its a count, if it is 0 we have to stop looping. As part of Bean Shell Post Processor, i have added a condition to wait if count is not equal to 0.

if(${check_1} != 0) {
    out("check Count not zero, waiting for 5 sec " + ${check_1});
    Thread.sleep(5000);
}else
    out("check Count is zero " + ${check_1});

Whats happening is, the result is something like this If the check_1 is > 0 , it waits for 5 sec and as soon as it is 0, it runs into infinite loop by executing the sampler multiple times

Is there something wrong with the condition. Please suggest if you have any other solution.

1

1 Answers

0
votes
  1. The correct way to use __javaScript() function and define condition is:

    ${__javaScript(${check_1} != 0,)}
    
  2. The correct way of accessing JMeter Variables from Beanshell is:

    if(vars.get("check_1").equals("0"))
    

Hope this helps.