Before test, I added x variables to TestPlans, After I run test as 10 thread 10 seconds ramp up In while controller for condition that
${__javaScript("${x}" != "",)}
In beanshell:
vars.put("x","");
Normally, each thread occured 1 second, First thread changed x variable as "", therefore another threads don't meet if condition. why do threads get looped though ?
Note: Other threads did not start testing when using property instead of variable.
As per JMeter documentation:
Properties are not the same as variables. Variables are local to a thread; properties are common to all threads
so when you do vars.put("x","");
you change x
variable value only for the current thread, other threads have their own values of the x
variable.
If you want to amend the value so it would be visible for all threads - you will have to:
vars.put("x","");
to props.put("x","");
${__javaScript("${__P(x,)}" != "",)}
Also: since JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language for scripting so it worth considering migrating (the same applies to __javaScript() function in the While Controller), more information: Beanshell vs. JSR223 vs. Java For JMeter: Complete Showdown