Hi Sebb,

"There was a problem with my test plan - there was a space after the Javascript function call, and so the expression was evaluating to "false " rather than "false"." made me look at my conditions expression in the while loop too and it was "${__javaScript("${moo}"=="Business")} " - So I had a space too. This was true in my real use case as well. Perhaps I picked it up by copying and pasting from the manual.

As you said this evaluates to "false " which I guess is cast to true at some point in Jmeter's code. To quote Admiral Ackbar, "IT'S A TRAP!!!"

Thank you.  You fixed my problem :-)

Don't know if it's the right thing to do but maybe you should run a trim before evaluation of the condition? Trim white spaces that. Saying not sure if it's the right way to go because that would be runtime and to keep the tests as accuate as possible you probably want to minimise any runtime work so maybe you should trim on save event and never let leading or trailing white spaces get in there. It was a difficult problem to pick up on & it would make it more user friendly. Up to you though of course.

Cheers!!!
Chad

sebb wrote:
On 20/10/2008, sebb <[EMAIL PROTECTED]> wrote:
On 16/10/2008, Anthony Chadszinow <[EMAIL PROTECTED]> wrote:
 > Hi,
 >

 Sorry, I've cleaned up my email and hope you can see where I'm coming from
 > now.
 >
 >  "What are you trying to achieve ?" - In a product I writing tests for a
 > processing popup opens and I need a loop to follow that popups progress.
 > The samplers following the popups progress should terminate the loop once
 > the popup tells me it should.  I can tell the loop should terminate because
 > while the popup should continue a piece of content is in it.  Once the popup
 > should terminate that content is gone.  So in practice, if the reg exp finds
 > a result which equals to what I was looking for in the loop then loop should
 > continue but if it's not found the loop should terminate.  The example I
 > presented reflected the same sort of base actions I'm performing however I
 > presented the example in a way that everyone could test if they wanted by
 > using www.google.com as my test case and modifying my reg expressions.
 > Since I'm still getting the same problem with my test case I believe if you
 > help me with my test case then it will address my real case.
 >
 >  "No need for dummy parameter if you are using JMeter 2.3.2" - I'm actually
 > using a nightly build but before emailing for help I tested this on 2.3.2 to
 > see if I would get the same problem on the stable release.  Is there no need
 > for dummy variable if I'm using a jmeter with a higher version than 2.3.2?
 > The manual said I needed dummy which is why I put it in there in the first
 > place
 > 
http://jakarta.apache.org/jmeter/usermanual/component_reference.html#logic_controllers
 > section '18.2.10 While Controller' in the examples of Condition clauses.
 >
 >  ""while ${moo} is equal to" seems to be something missing here ???" -
 > Sorry, I meant to say while ${moo} is equal to "Business" keep going.  If
 > you give my reg exp a try on www.google.com you would see that <a
 > href="/services/">(.*?) Solutions</a> returns "Business" so the first
 > sampler sets the variable to something which will make the loop go and then
 > the internal reg expression is meant to set the variable to something other
 > than "Business" which should terminate the loop.
 >
 >  "Better to use a Debug Sampler, or a Java Request so you don't make
 > unnecessary HTTP requests.", "What do you mean by that?" - Thanks, I've now
 > worked out I've been using the debug sampler wrong.  I was always putting it
 > at the bottom of my test plans but now I see you can drop any number of
 > debug samplers anywhere.  This was quite a noob mistake when I look back at
 > it.  I've modified my test case such that it looks like as follows now
 >
 >   1. View Results Tree
 >   2. Http Sampler getting www.google.com
 >   3. Child of above sampler - Reg Exp Extractor with settings Ref
 >      name=moo, reg exp=<a href="/services/">(.*?) Solutions</a>,
 >      template=$1$, match no=1, def val=not_found
 >   4. Debug Sampler
 >   5. While loop with settings
 >      condition=${__javaScript("${moo}"=="Business")} so
 > loop while
 >      ${moo} is equal to "Business" then continue looping
 >   6. Child of loop - Http sampler getting www.google.com
 >   7. Child of above Http sampler - Reg Exp Extractor with settings Ref
 >      name=moo, reg
 > exp=content_that_wont_be_here(.*)no_not_at_all,
 >      template=$1$, match no=1, def val=not_found
 >   8. Child of loop - Debug Sampler
 >
 >  At debug sampler #4 ${moo} = "Business" as expected and the loop is
 > entered. At debug sampler #8 ${moo} = "not_found" however my loop never
 > terminates.
 >
 >  So in the end I still have my same problem which is an infinite loop.  I'm
 > now suspecting this is a variable scoping issue and that the reg exp in the
 > loop cannot effect the variables value at the loops Condition scope level.
 > If this is the case how can I do this example in another way to achieve what
 > I'm after?


The Debug sampler output will show that it is not a variable scoping issue.

 There seems to be a problem with the While Controller not
 re-evaluating the condition properly. Not sure why this is yet.

Duh! Finger trouble. There was a problem with my test plan - there was
a space after the Javascript function call, and so the expression was
evaluating to "false " rather than "false".

Try enabling Debug on the While Controller - select the controller and
use the Help menu item to enable debug. This will log the condition
value.

 Try setting the default value to "false" in step #7, and using the
 condition "${moo}" in step #5 (in both cases remove the quotes).


 >  Cheers,
 >  Chad
 >
 >  sebb wrote:
 >
 > >
 > > On 16/10/2008, Anthony Chadszinow <[EMAIL PROTECTED]> wrote:
 > >
 > >
 > > > Hi,
 > > >
 > > >  I've had trouble with a while loop so I built a dumbed down example of
 > what
 > > > I'm really doing to explain my infinite loop problem.  Feel free to
 > build
 > > > this yourself because there's only 6 operators.
 > > >
 > > >
 > >
 > > What are you trying to achieve ?
 > >
 > >
 > >
 > > >  In thread group I have -
 > > >
 > > >  1. View Results Tree
 > > >  2. Http Sampler getting www.google.com
 > > >  3. Child of above sampler - Reg Exp Extrator with settings Ref
 > > >     name=moo, reg exp=<a href="/services/">(.*?) Solutions</a>,
 > > >     template=$1$, match no=1, def val=not_found
 > > >  4. While loop with settings
 > > >
 > condition=${__javaScript("${moo}"=="Business",dummy)}
 > > >
 > > >
 > >
 > > No need for dummy parameter if you are using JMeter 2.3.2
 > >
 > >
 > >
 > > > so loop
 > > >     while ${moo} is equal to
 > > >
 > > >
 > >
 > > seems to be something missing here ???
 > >
 > >
 > >
 > > >  5. Child of loop - Http sampler getting www.google.com with get var
 > > >     moo_is=${moo} <--- to expose what moo is at any point in time
 > > >
 > > >
 > >
 > > Better to use a Debug Sampler, or a Java Request so you don't make
 > > unnecessary HTTP requests.
 > >
 > >
 > >
 > > >  6. Child of above Http sampler - Reg Exp Extractor with settings Ref
 > > >     name=moo, reg
 > > > exp=content_that_wont_be_here(.*)no_not_at_all,
 > > >     template=$1$, match no=1, def val=not_found
 > > >
 > > >  No debug sampler because it's infinite so I have to kill processes and
 > > > debug sampler never comes up anyway.
 > > >
 > > >
 > >
 > > What do you mean by that?
 > >
 > >
 > >
 > > >  So the point of operator #6 is it's going to set ${moo}to not found
 > after
 > > > the first iteration because the reg expression will never match and it
 > does
 > > > this as expected.  This is proved by view results tree 'Request' tab.
 > On
 > > > the first iteration of the loop the google request get var 'moo_is' has
 > the
 > > > value "Business" which is why the loop iterates at least once just as it
 > > > should.  All requests that follow have 'moo_is' equal to "not_found"
 > which
 > > > is what I expect however my loop never stops.  What am I doing wrong
 > here?
 > > >
 > > >  Cheers,
 > > >  Chad
 > > >
 > > >  --
 > > >  Anthony Chadszinow
 > > >  MySource Classic Lead Developer
 > > >
 > > >  Squiz
 > > >  92 Jarrett St Leichhardt, Sydney NSW, Australia 2040 t:    13000 SQUIZ
 > (
 > > > Support )
 > > >  t:    8507 9900 / 1300 130 661
 > > >  f:    8507 9988
 > > >  w:    www.matrix.squiz.net
 > > >  w:    www.squiz.net
 > > >
 > > >  Sydney  |  Melbourne  |  Canberra  |  Hobart  |  Wellington  |  London
 > > >  Open Source  - Own it  -  Squiz.net
 > > >  ----------------------------------------------------
 > > >
 > > >  IMPORTANT:This email (and any attachments) is commercial-in-confidence
 > and
 > > >  or may be legally privileged and must not be forwarded, copied or
 > shared
 > > >  without express permission from Squiz. If you are not the intended
 > > >  recipient, you may not legally copy, disclose or use the contents in
 > any
 > > > way
 > > >  and you should contact [EMAIL PROTECTED] immediately and destroy this
 > message
 > > > and any
 > > >  attachments. Thank you.
 > > >
 > > >
 > > >
 > > >
 > >
 > >
 > ---------------------------------------------------------------------
 > > To unsubscribe, e-mail:
 > [EMAIL PROTECTED]
 > > For additional commands, e-mail:
 > [EMAIL PROTECTED]
 > >
 > >
 > >
 > >
 >
 >  --
 >  Anthony Chadszinow
 >  MySource Classic Lead Developer
 >
 >  Squiz
 >  92 Jarrett St Leichhardt, Sydney NSW, Australia 2040 t:    13000 SQUIZ (
 > Support )
 >  t:    8507 9900 / 1300 130 661
 >  f:    8507 9988
 >  w:    www.matrix.squiz.net
 >  w:    www.squiz.net
 >
 >  Sydney  |  Melbourne  |  Canberra  |  Hobart  |  Wellington  |  London
 >  Open Source  - Own it  -  Squiz.net
 >  ----------------------------------------------------
 >
 >  IMPORTANT:This email (and any attachments) is commercial-in-confidence and
 >  or may be legally privileged and must not be forwarded, copied or shared
 >  without express permission from Squiz. If you are not the intended
 >  recipient, you may not legally copy, disclose or use the contents in any
 > way
 >  and you should contact [EMAIL PROTECTED] immediately and destroy this 
message
 > and any
 >  attachments. Thank you.
 >
 >


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Anthony Chadszinow
MySource Classic Lead Developer

Squiz
92 Jarrett St Leichhardt, Sydney NSW, Australia 2040 t: 13000 SQUIZ ( Support )
t:    8507 9900 / 1300 130 661
f:    8507 9988
w:    www.matrix.squiz.net
w:    www.squiz.net

Sydney | Melbourne | Canberra | Hobart | Wellington | London Open Source - Own it - Squiz.net
----------------------------------------------------

IMPORTANT:This email (and any attachments) is commercial-in-confidence and
or may be legally privileged and must not be forwarded, copied or shared
without express permission from Squiz. If you are not the intended
recipient, you may not legally copy, disclose or use the contents in any way
and you should contact [EMAIL PROTECTED] immediately and destroy this message and any
attachments. Thank you.

Reply via email to