You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by Lorenzo Fundaró <lo...@gmail.com> on 2014/11/18 11:49:52 UTC

possible issue with While Controller

Hello,

I think I discovered what it might possibly be an issue in JMeter 2.11
r1554548

So here's the story:

I have a BeanShell PreProcessor that puts a variable like this:
vars.put("DONE_UPLOAD","false");
then,
I have a While controller that evaluates this variable like this:
${__javaScript("${DONE_UPLOAD}" == "false")}
then inside the While controller I have an HTTP Request sampler that
responds to either 200 or 202.
After the sampler (still inside the WhileController) I have a Beanshell
PostProcessor that does this:
if (prev.getResponseCode().equals("200")) {
vars.put("DONE_UPLOAD","200");
}
So the the set of instructions above could be described as "Do the HTTP
request until the response code changes to 200"

This flow does not work as expected, even thought I believe there are no
syntax errors.
However, it DOES work whenever I added a "Debug Sampler before the While
Controller".

Why is this ? it seems like the While controller is not properly evaluating
the variable on each iteration but the Debug Sampler does it for him.

Note that the Debug Sampler must also be outside of the  While Controller.
I could send you guys a little Jmeter test plan with an example proving
this strange behaviour.

Thank you.

Lorenzo Fundaró García

Re: possible issue with While Controller

Posted by sebb <se...@gmail.com>.
The issues list is intended for recording additions to the bug
tracking system, i.e. Bugzilla in the case of JMeter.

Please subscribe to the JMeter user list and post there instead.

If necessary, you will be asked to raise a Bugzilla issue, to which
you can then attach any test plan, logs etc.

Thanks.

On 18 November 2014 10:49, Lorenzo Fundaró <lo...@gmail.com> wrote:
> Hello,
>
> I think I discovered what it might possibly be an issue in JMeter 2.11
> r1554548
>
> So here's the story:
>
> I have a BeanShell PreProcessor that puts a variable like this:
> vars.put("DONE_UPLOAD","false");
> then,
> I have a While controller that evaluates this variable like this:
> ${__javaScript("${DONE_UPLOAD}" == "false")}
> then inside the While controller I have an HTTP Request sampler that
> responds to either 200 or 202.
> After the sampler (still inside the WhileController) I have a Beanshell
> PostProcessor that does this:
> if (prev.getResponseCode().equals("200")) {
> vars.put("DONE_UPLOAD","200");
> }
> So the the set of instructions above could be described as "Do the HTTP
> request until the response code changes to 200"
>
> This flow does not work as expected, even thought I believe there are no
> syntax errors.
> However, it DOES work whenever I added a "Debug Sampler before the While
> Controller".
>
> Why is this ? it seems like the While controller is not properly evaluating
> the variable on each iteration but the Debug Sampler does it for him.
>
> Note that the Debug Sampler must also be outside of the  While Controller.
> I could send you guys a little Jmeter test plan with an example proving
> this strange behaviour.
>
> Thank you.
>
> Lorenzo Fundaró García

Re: possible issue with While Controller

Posted by Lorenzo Fundaró <lo...@gmail.com>.
@Flavio, that's what I did, I used a BeanShell Sampler and it did the
trick.

@sebb your suggestion also works.

Thank you guys. I appreciate your help. Great community :)




Lorenzo Fundaró García

On Tue, Nov 18, 2014 at 3:52 PM, sebb <se...@gmail.com> wrote:

> You could also change the While condition to:
>
> ${CONTINUE}
>
> and change the Post-Processor to
>
> vars.put("CONTINUE","false");
>
> You don't then need to initialise the variable.
>
> Note that you can also initialiase variables on the Test Plan.
> The initial values are copied to each thread; subsequent changes apply
> to the thread only.
>
> On 18 November 2014 12:49, Flavio Cysne <fl...@gmail.com> wrote:
> > @Lorenzo if you only need to set a initial value to a variable (in you
> case
> > "DONE_UPLOAD") you could do this in BeanShell Sampler. If this is the
> case,
> > there's no need to use a Post-Processor.
> >
> > 2014-11-18 9:33 GMT-03:00 Lorenzo Fundaró <lo...@gmail.com>:
> >
> >> @Flavio your suggestion works best for me when using a Beanshell
> Sampler.
> >> Defining a User Variable it's not what I want because they have Thread
> >> Group scope. So now, the While Controller works putting a Beanshell
> Sampler
> >> before it and using a Beanshell PostProcessor. Thank you.
> >>
> >>
> >> Lorenzo Fundaró García
> >>
> >> On Tue, Nov 18, 2014 at 12:48 PM, Flavio Cysne <fl...@gmail.com>
> >> wrote:
> >>
> >> > If you are using BeanShell Pre-Processor so it will be triggered only
> for
> >> > the samplers.
> >> >
> >> > I'm supposing that While Controller wasn't been executed, because
> >> BeanShell
> >> > Pre-Processor (or even Post-Processor) will not be triggered until a
> >> > Sampler is executed.
> >> >
> >> > That's why when you add a Debug Sampler before the While Controller it
> >> > works.
> >> >
> >> > Use an User Defined Variables configuration element to initialize
> >> > "DONE_UPLOAD" 's value or a BeanShell Sampler.
> >> >
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

Re: possible issue with While Controller

Posted by sebb <se...@gmail.com>.
You could also change the While condition to:

${CONTINUE}

and change the Post-Processor to

vars.put("CONTINUE","false");

You don't then need to initialise the variable.

Note that you can also initialiase variables on the Test Plan.
The initial values are copied to each thread; subsequent changes apply
to the thread only.

On 18 November 2014 12:49, Flavio Cysne <fl...@gmail.com> wrote:
> @Lorenzo if you only need to set a initial value to a variable (in you case
> "DONE_UPLOAD") you could do this in BeanShell Sampler. If this is the case,
> there's no need to use a Post-Processor.
>
> 2014-11-18 9:33 GMT-03:00 Lorenzo Fundaró <lo...@gmail.com>:
>
>> @Flavio your suggestion works best for me when using a Beanshell Sampler.
>> Defining a User Variable it's not what I want because they have Thread
>> Group scope. So now, the While Controller works putting a Beanshell Sampler
>> before it and using a Beanshell PostProcessor. Thank you.
>>
>>
>> Lorenzo Fundaró García
>>
>> On Tue, Nov 18, 2014 at 12:48 PM, Flavio Cysne <fl...@gmail.com>
>> wrote:
>>
>> > If you are using BeanShell Pre-Processor so it will be triggered only for
>> > the samplers.
>> >
>> > I'm supposing that While Controller wasn't been executed, because
>> BeanShell
>> > Pre-Processor (or even Post-Processor) will not be triggered until a
>> > Sampler is executed.
>> >
>> > That's why when you add a Debug Sampler before the While Controller it
>> > works.
>> >
>> > Use an User Defined Variables configuration element to initialize
>> > "DONE_UPLOAD" 's value or a BeanShell Sampler.
>> >
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Re: possible issue with While Controller

Posted by Flavio Cysne <fl...@gmail.com>.
@Lorenzo if you only need to set a initial value to a variable (in you case
"DONE_UPLOAD") you could do this in BeanShell Sampler. If this is the case,
there's no need to use a Post-Processor.

2014-11-18 9:33 GMT-03:00 Lorenzo Fundaró <lo...@gmail.com>:

> @Flavio your suggestion works best for me when using a Beanshell Sampler.
> Defining a User Variable it's not what I want because they have Thread
> Group scope. So now, the While Controller works putting a Beanshell Sampler
> before it and using a Beanshell PostProcessor. Thank you.
>
>
> Lorenzo Fundaró García
>
> On Tue, Nov 18, 2014 at 12:48 PM, Flavio Cysne <fl...@gmail.com>
> wrote:
>
> > If you are using BeanShell Pre-Processor so it will be triggered only for
> > the samplers.
> >
> > I'm supposing that While Controller wasn't been executed, because
> BeanShell
> > Pre-Processor (or even Post-Processor) will not be triggered until a
> > Sampler is executed.
> >
> > That's why when you add a Debug Sampler before the While Controller it
> > works.
> >
> > Use an User Defined Variables configuration element to initialize
> > "DONE_UPLOAD" 's value or a BeanShell Sampler.
> >
>

Re: possible issue with While Controller

Posted by Lorenzo Fundaró <lo...@gmail.com>.
@Flavio your suggestion works best for me when using a Beanshell Sampler.
Defining a User Variable it's not what I want because they have Thread
Group scope. So now, the While Controller works putting a Beanshell Sampler
before it and using a Beanshell PostProcessor. Thank you.


Lorenzo Fundaró García

On Tue, Nov 18, 2014 at 12:48 PM, Flavio Cysne <fl...@gmail.com>
wrote:

> If you are using BeanShell Pre-Processor so it will be triggered only for
> the samplers.
>
> I'm supposing that While Controller wasn't been executed, because BeanShell
> Pre-Processor (or even Post-Processor) will not be triggered until a
> Sampler is executed.
>
> That's why when you add a Debug Sampler before the While Controller it
> works.
>
> Use an User Defined Variables configuration element to initialize
> "DONE_UPLOAD" 's value or a BeanShell Sampler.
>

Re: possible issue with While Controller

Posted by Flavio Cysne <fl...@gmail.com>.
If you are using BeanShell Pre-Processor so it will be triggered only for
the samplers.

I'm supposing that While Controller wasn't been executed, because BeanShell
Pre-Processor (or even Post-Processor) will not be triggered until a
Sampler is executed.

That's why when you add a Debug Sampler before the While Controller it
works.

Use an User Defined Variables configuration element to initialize
"DONE_UPLOAD" 's value or a BeanShell Sampler.

Re: possible issue with While Controller

Posted by Lorenzo Fundaró <lo...@gmail.com>.
I am getting the same behaviour with 2.12.


Lorenzo Fundaró García

On Tue, Nov 18, 2014 at 12:23 PM, UBIK LOAD PACK Support <
support@ubikloadpack.com> wrote:

> Hi,
> Can you check using last version 2.12.
>
> You may be facing a fixed bug 56160
>
> Regards
> @ubikloadpack
>
>
> On Tue, Nov 18, 2014 at 11:49 AM, Lorenzo Fundaró <
> lorenzofundaro@gmail.com> wrote:
>
>> Hello,
>>
>> I think I discovered what it might possibly be an issue in JMeter 2.11
>> r1554548
>>
>> So here's the story:
>>
>> I have a BeanShell PreProcessor that puts a variable like this:
>> vars.put("DONE_UPLOAD","false");
>> then,
>> I have a While controller that evaluates this variable like this:
>> ${__javaScript("${DONE_UPLOAD}" == "false")}
>> then inside the While controller I have an HTTP Request sampler that
>> responds to either 200 or 202.
>> After the sampler (still inside the WhileController) I have a Beanshell
>> PostProcessor that does this:
>> if (prev.getResponseCode().equals("200")) {
>> vars.put("DONE_UPLOAD","200");
>> }
>> So the the set of instructions above could be described as "Do the HTTP
>> request until the response code changes to 200"
>>
>> This flow does not work as expected, even thought I believe there are no
>> syntax errors.
>> However, it DOES work whenever I added a "Debug Sampler before the While
>> Controller".
>>
>> Why is this ? it seems like the While controller is not properly
>> evaluating
>> the variable on each iteration but the Debug Sampler does it for him.
>>
>> Note that the Debug Sampler must also be outside of the  While Controller.
>> I could send you guys a little Jmeter test plan with an example proving
>> this strange behaviour.
>>
>> Thank you.
>>
>> Lorenzo Fundaró García
>>
>
>
>

Re: possible issue with While Controller

Posted by UBIK LOAD PACK Support <su...@ubikloadpack.com>.
Hi,
Can you check using last version 2.12.

You may be facing a fixed bug 56160

Regards
@ubikloadpack

On Tue, Nov 18, 2014 at 11:49 AM, Lorenzo Fundaró <lo...@gmail.com>
wrote:

> Hello,
>
> I think I discovered what it might possibly be an issue in JMeter 2.11
> r1554548
>
> So here's the story:
>
> I have a BeanShell PreProcessor that puts a variable like this:
> vars.put("DONE_UPLOAD","false");
> then,
> I have a While controller that evaluates this variable like this:
> ${__javaScript("${DONE_UPLOAD}" == "false")}
> then inside the While controller I have an HTTP Request sampler that
> responds to either 200 or 202.
> After the sampler (still inside the WhileController) I have a Beanshell
> PostProcessor that does this:
> if (prev.getResponseCode().equals("200")) {
> vars.put("DONE_UPLOAD","200");
> }
> So the the set of instructions above could be described as "Do the HTTP
> request until the response code changes to 200"
>
> This flow does not work as expected, even thought I believe there are no
> syntax errors.
> However, it DOES work whenever I added a "Debug Sampler before the While
> Controller".
>
> Why is this ? it seems like the While controller is not properly evaluating
> the variable on each iteration but the Debug Sampler does it for him.
>
> Note that the Debug Sampler must also be outside of the  While Controller.
> I could send you guys a little Jmeter test plan with an example proving
> this strange behaviour.
>
> Thank you.
>
> Lorenzo Fundaró García
>