I have been trying to use the "While Controller" in JMeter 2.0.3 with
no luck. This could be due to two things: user error (since I'm not sure my Condition is in the correct form), or the While Controller is a little too alpha not work as advertised. Inside the While Controller, I grab a page using "HTTP Request Sampler" and use "Regular Expression Extractor" to populate a variable called "encodedState". I would like the While Controller to loop until encodedState equals the string "ENCODED". I have tried a variety of conditions on the While Controller with no luck. What should the condition look like? Javascript? Pure java? BeanShell? I tried several guesses: ${encodedState} != "ENCODED" ${__javaScript(${encodedState}!="ENCODED")} !(${encodedState}.equals("ENCODED")) . . . you get the idea. If the While Controller is just too alpha to handle the Condition correctly, is there some other way to get this type of behavior? Cheers, AK --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
On 6/1/05, Andy Kappen <[hidden email]> wrote:
> I have been trying to use the "While Controller" in JMeter 2.0.3 with > no luck. This could be due > to two things: user error (since I'm not sure my Condition is in the > correct form), or the While > Controller is a little too alpha not work as advertised. > > Inside the While Controller, I grab a page using "HTTP Request > Sampler" and use "Regular > Expression Extractor" to populate a variable called "encodedState". I > would like the While > Controller to loop until encodedState equals the string "ENCODED". Another way to do this would be to use the LAST condition with a suitable Response Assertion to flag the Sampler as failed. > I have tried a variety of conditions on the While Controller with no > luck. What should the > condition look like? Javascript? Pure java? BeanShell? I tried This is documented here: http://jakarta.apache.org/jmeter/usermanual/component_reference.html#While_Controller > several guesses: Assume encodedState = ENCODED. > ${encodedState} != "ENCODED" This is interpreted as the string: ENCODED != "ENCODED" which is not the same as FALSE or false. > ${__javaScript(${encodedState}!="ENCODED")} Almost correct, this is interpreted as the string: ENCODED != "ENCODED" which is not valid JavaScript [well, unless ENCODED is a JavaScript variable] ${__javaScript("${encodedState}"!="ENCODED")} should work, i.e. quote the string. > !(${encodedState}.equals("ENCODED")) This is interpreted as the string !(ENCODED.equals("ENCODED")) which is not false or FALSE Try ${__BeanShell(!"${encodedState}".equals("ENCODED")) S. --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
Adding a Response Assertion and using a while condition of LAST worked great.
On the other hand, I have tried both the ${__javaScript("${encodedState}"!="ENCODED")} and the ${__BeanShell(!"${encodedState}".equals("ENCODED")) forms suggested, and the While Controller still just enters an infinite loop. I read a comment on another forum somewhere that implied the While Controller does not re-evaluate the condition during each loop, but there was no mention of the jmeter version effected. Is this apparently broken behavior a side effect of the 'alpha' nature of the while controller? Should I file a bug on this? Cheers, AK On 6/1/05, sebb <[hidden email]> wrote: > On 6/1/05, Andy Kappen <[hidden email]> wrote: > > I have been trying to use the "While Controller" in JMeter 2.0.3 with > > no luck. This could be due > > to two things: user error (since I'm not sure my Condition is in the > > correct form), or the While > > Controller is a little too alpha not work as advertised. > > > > Inside the While Controller, I grab a page using "HTTP Request > > Sampler" and use "Regular > > Expression Extractor" to populate a variable called "encodedState". I > > would like the While > > Controller to loop until encodedState equals the string "ENCODED". > > Another way to do this would be to use the LAST condition with a > suitable Response Assertion to flag the Sampler as failed. > > > I have tried a variety of conditions on the While Controller with no > > luck. What should the > > condition look like? Javascript? Pure java? BeanShell? I tried > > This is documented here: > http://jakarta.apache.org/jmeter/usermanual/component_reference.html#While_Controller > > > several guesses: > > Assume encodedState = ENCODED. > > > ${encodedState} != "ENCODED" > > This is interpreted as the string: > > ENCODED != "ENCODED" > > which is not the same as FALSE or false. > > > ${__javaScript(${encodedState}!="ENCODED")} > > Almost correct, this is interpreted as the string: > > ENCODED != "ENCODED" > > which is not valid JavaScript > [well, unless ENCODED is a JavaScript variable] > > ${__javaScript("${encodedState}"!="ENCODED")} > > should work, i.e. quote the string. > > > !(${encodedState}.equals("ENCODED")) > > This is interpreted as the string > > !(ENCODED.equals("ENCODED")) > > which is not false or FALSE > > Try > > ${__BeanShell(!"${encodedState}".equals("ENCODED")) > > S. > --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
Free forum by Nabble | Edit this page |