You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Sankar Das <00...@gmail.com> on 2017/02/06 12:35:23 UTC

While controller is not ending the loop

Hi,

I am trying with while controller but not successful.Please help

Scenario:

Login
Search
Keep click on Next button. go to next page and click next button until
there is no products available.
logout

So I have extract the "Next" from "search" then used while loop.

Login
Search
--regular expression ex
While controller >>${__javaScript(!"${VAR2}".equals("Next"))
--Click next sampler
Logout

When I am running the script, the https request with all the nexts are
running properly. But when the condition is failed also "click next"
samplers are running

Can someone help what I am missing.

Thanks

Re: While controller is not ending the loop

Posted by Deepak Shetty <sh...@gmail.com>.
>I tried with providing a assertion and running the while loop. Now the
loop is ending
Makes no sense. An assertion doesnt impact the running of the loop

>How can I end the loop ?
whenever the condition returns  "false" , the loop will end . You might not
be doing something like resetting the value of the variable (missing in
your original snippet(
 Add a debug sampler within the loop and see. And as before always inspect
jmeter.log

On Mon, Feb 6, 2017 at 11:56 AM, Sankar Das <00...@gmail.com>
wrote:

> Thanks for the reply. I tried with that one too. But the thing is the while
> loop is not ending because it trying to meet the conditions.
>
> I tried with providing a assertion and running the while loop. Now the loop
> is ending but my last sampler is getting failed and that is getting
> reflected as error in the report.
>
> How can I end the loop ?
>
> On Feb 6, 2017 9:37 PM, "Deepak Shetty" <sh...@gmail.com> wrote:
>
> > Hi
> > javascript doesnt have a .equals method if I remember correctly. Check
> your
> > log for errors.
> > ${__javaScript("${VAR2}" == "Next")} is probably what you are looking for
> >
> >
> > regards
> > deepak
> >
> > On Mon, Feb 6, 2017 at 4:35 AM, Sankar Das <00...@gmail.com>
> > wrote:
> >
> > > Hi,
> > >
> > > I am trying with while controller but not successful.Please help
> > >
> > > Scenario:
> > >
> > > Login
> > > Search
> > > Keep click on Next button. go to next page and click next button until
> > > there is no products available.
> > > logout
> > >
> > > So I have extract the "Next" from "search" then used while loop.
> > >
> > > Login
> > > Search
> > > --regular expression ex
> > > While controller >>${__javaScript(!"${VAR2}".equals("Next"))
> > > --Click next sampler
> > > Logout
> > >
> > > When I am running the script, the https request with all the nexts are
> > > running properly. But when the condition is failed also "click next"
> > > samplers are running
> > >
> > > Can someone help what I am missing.
> > >
> > > Thanks
> > >
> >
>

Re: While controller is not ending the loop

Posted by Sankar Das <00...@gmail.com>.
Thanks for the reply. I tried with that one too. But the thing is the while
loop is not ending because it trying to meet the conditions.

I tried with providing a assertion and running the while loop. Now the loop
is ending but my last sampler is getting failed and that is getting
reflected as error in the report.

How can I end the loop ?

On Feb 6, 2017 9:37 PM, "Deepak Shetty" <sh...@gmail.com> wrote:

> Hi
> javascript doesnt have a .equals method if I remember correctly. Check your
> log for errors.
> ${__javaScript("${VAR2}" == "Next")} is probably what you are looking for
>
>
> regards
> deepak
>
> On Mon, Feb 6, 2017 at 4:35 AM, Sankar Das <00...@gmail.com>
> wrote:
>
> > Hi,
> >
> > I am trying with while controller but not successful.Please help
> >
> > Scenario:
> >
> > Login
> > Search
> > Keep click on Next button. go to next page and click next button until
> > there is no products available.
> > logout
> >
> > So I have extract the "Next" from "search" then used while loop.
> >
> > Login
> > Search
> > --regular expression ex
> > While controller >>${__javaScript(!"${VAR2}".equals("Next"))
> > --Click next sampler
> > Logout
> >
> > When I am running the script, the https request with all the nexts are
> > running properly. But when the condition is failed also "click next"
> > samplers are running
> >
> > Can someone help what I am missing.
> >
> > Thanks
> >
>

Re: While controller is not ending the loop

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
javascript doesnt have a .equals method if I remember correctly. Check your
log for errors.
${__javaScript("${VAR2}" == "Next")} is probably what you are looking for


regards
deepak

On Mon, Feb 6, 2017 at 4:35 AM, Sankar Das <00...@gmail.com>
wrote:

> Hi,
>
> I am trying with while controller but not successful.Please help
>
> Scenario:
>
> Login
> Search
> Keep click on Next button. go to next page and click next button until
> there is no products available.
> logout
>
> So I have extract the "Next" from "search" then used while loop.
>
> Login
> Search
> --regular expression ex
> While controller >>${__javaScript(!"${VAR2}".equals("Next"))
> --Click next sampler
> Logout
>
> When I am running the script, the https request with all the nexts are
> running properly. But when the condition is failed also "click next"
> samplers are running
>
> Can someone help what I am missing.
>
> Thanks
>