Remember Dan: the folks that are giving you terse answers are also giving terse 
answers to a great number of people not only on the user ML but also the dev ML 
and dealing with Bugzilla and committing source and developing source and 
testing source and giving terse answers to JMeter developers and ...

Dan Tripp wrote ..
> Thanks a bunch for this response, Steve.  It's far more helpful to get a 
> meaningful,
> fleshed-out response than to get terse, sarcastic non-answers.  I'm already 
> struggling
> enough with trying to use JMeter... I don't need more grief because I don't 
> intuitively
> understand quirks in poorly-documented software.  :)
> 
> I especially appreciate the info. on common "gotchas."  I know my code's worst
> enemy is my own typing.  It looks to me like my big mistake was thinking that 
> the
> User Defined Variables was useful for evaluating expressions and assigning 
> them
> to variables.  It's obviously the wrong component to use for what I'm trying 
> to
> accomplish.
> 
> The problem I'm trying to solve involves cycling through pagination for 
> different
> media types.  For example, we have pages which allow users to browse through 
> several
> media categories (movies, audio, etc., as well as an "all media" category) and
> I wanted to ensure that I touched them all.  Since the tests I'm trying to 
> write
> will upload images, etc., the total number of assets for each media type will 
> change,
> which will affect pagination.  We're displaying four items per page, so I need
> to extract the total # of media items per category (which was totally easy to 
> do
> with the Regular Expression Extractor) and then divide that result by 4 
> (seemingly
> nigh-unto-freaking-impossible).  I then need to add 1 to the total if there's 
> a
> remainder (modulus).  So, I'm trying to do this:
> 
> assets_per_category = numeric_result_from_the_regex
> 
> num_of_pages_for_category = assets_per_category / 4
> if assets_per_category % 4 > 0
>   num_of_pages_for_category += 1
> end
> 
> I have no idea as to where to stick this in JMeter, and that's frustrating me 
> to
> the point where I'm coming up with creative ideas as to what JMeter can stick 
> where.
> ;)
> 
> There are all kinds of components to do things that would be otherwise
> dirt-simple in a code block, but there doesn't seem to be a place to
> stick a code block.
> 
> 
> > What I would like to see in jmeter though is a
> > element that can be used just for processing
> > expressions, etc.  It seems many of the functions,
> > etc are intended to used 'in line' vs the model
> > of modifying variables and expressions first,
> > then passing them into the samplers/etc. Maybe
> > an 'executor' block :)
> 
> This is exactly what I've been trying to wrap my head around and having 
> something
> like a Expression/Block Processor Component would have helped me tremendously.
> I've been trying to get a BeanShell script to work, but JMeter's not finding 
> the
> jar which is sitting right next to it.  /sigh  /insert lengthy rant about how 
> hard
> it is to make Java do stuff if you're not a Java SuperGenius.
> 
> 
> > It's confusing at first, but once you know what's
> > happening its not so bad to work with.
> 
> So you're suggesting that once my head is caved-in from beating my head on my 
> desk
> in frustration that there's a light at the end of the tunnel?  SUH-WEET!  :)
> 
> 
> > You must live with the assumption that if jmeter
> > doesn't understand the reference, it will just be
> > passed as a literal string.
> 
> I noticed that early-on, and yes, it was surprising.  I'm coming to appreciate
> the fact that JMeter generally does things 180 degrees of what I find to be 
> intuitive.
> 
> 
> > The rest is just coping with no syntax or reference
> > checking... So the burden of debugging is on you.
> 
> Is "Screw you, Tester" the official motto of JMeter?  It looks like it was 
> designed
> for people with little-to-no programming experience yet it requires knowledge 
> of
> a bunch of stuff that I frankly didn't want to learn just to make it do simple
> stuff like dividing numbers.
> 
> I'm glad that I finally know to use ${__jexl(a+b)} (although NOT in UDV), but 
> seriously,
> why is the syntax to do simple math so convoluted?  I'd NEVER have guessed 
> that
> I needed to use something called "jexl" to do simple evals.
> 
> That said however, now that I understand what it is and why it might be useful
> to me, I think jexl is kinda cool and that the jexl syntax is "obvious."  Two 
> sentences
> in the documentation would have saved me hours of grief.
> 
> "jexl, javascript, or [whatever voodoo I don't understand] can be used to 
> evaluate
> expressions."
> 
> Actually, just that one sentence would have made a big difference.
> 
> 
> > Yes you must use javascript, but its stupid simple.
> > Javascript help on operators
> 
> Yeah, now that I understand that's the way JMeter works, I can deal.  I 
> appreciate
> the link/reference, though I already know 'nuff JS to be dangerous.  :)
> 
> In my original post, I was trying to use UDV for this purpose but have come to
> an appreciation of the fact that it's just the flat-wrong thing to do.  
> However,
> I still don't know the answer to "WHERE does this kind of stuff go?"  Do I 
> have
> to insert these inline somewhere?
> 
> Again, many thanks for the helpful response,
> 
> - Dan
> 
> 
> 
> ----- Original Message ----
> From: Steve Kapinos <[EMAIL PROTECTED]>
> To: JMeter Users List <[email protected]>
> Sent: Friday, April 11, 2008 4:53:34 AM
> Subject: RE: Understanding How to Twiddle Values in JMeter
> 
> >So, you're suggesting that I should learn Jexl so that I can divide one
> number by another in JMeter?
> 
> Yes you must use javascript, but its stupid simple.  Javascript help on
> operators
> http://www.w3schools.com/js/js_operators.asp
> 
> Functions are very simple
> 
> ${__jexl(${log1ID}+1)}
> 
> >Wow, that's absolutely NOT what I'd expect and I don't see that
> mentioned anywhere in the documentation.
> 
> I came across this as well.. Basically you can't reference another
> variable in a UDV that was defined in that same UDV element.  Things
> aren't ready till the end of the element.  sebb added to the
> documentation in-progress at that point to help make that clear.  
> 
> >*Should* work and *does* work are totally different things.  My
> experience with JMeter suggests that JMeter is
> >remarkably inconsistent as to what text fields/etc. are actually
> interpreted
> 
> It's confusing at first, but once you know what's happening its not so
> bad to work with.  You must live with the assumption that if jmeter
> doesn't understand the reference, it will just be passed as a literal
> string.  This includes undefined variable names or syntax mismatches.
> Basically, instead of stopping and erroring, its going to continue and
> pass that as a string 'as is' rather then evaluate it.
> 
> Common things I found that trip you up
> - case sensativity in function and variable names
> - the usual { vs ( typos
> - typos or mismatches in variable or function names
> 
> People are accustomed to the program halting on syntax checking or
> references and jmeter simply doesn't do that.  So any errors must be
> caught through monitoring the values being used.  Only when you get
> invalid parameters in some of the samplers, etc do you typically get an
> exception at run time.
> 
> The key is to use the debug sampler often when writing the script to
> monitor the variables and properties to ensure you are manipulating what
> you expect.  Every time I had problems like you described, it was
> typically one of the above problems.  The UDV issue of referencing the
> variable that was just defined in the same element has been the only
> real problem I've encounter.  The rest is just coping with no syntax or
> reference checking... So the burden of debugging is on you.
> 
> What I would like to see in jmeter though is a element that can be used
> just for processing expressions, etc.  It seems many of the functions,
> etc are intended to used 'in line' vs the model of modifying variables
> and expressions first, then passing them into the samplers/etc. Maybe an
> 'executor' block :)
> 
> 
> ----- Original Message ----
> From: sebb <[EMAIL PROTECTED]>
> To: JMeter Users List <[email protected]>
> Sent: Thursday, April 10, 2008 6:20:03 PM
> Subject: Re: Understanding How to Twiddle Values in JMeter
> 
> On 11/04/2008, Dan Tripp <[EMAIL PROTECTED]> wrote:
> > Howdy All,
> >
> >  I'm trying to perform some simple calculations with data I've
> extracted using an HTTP sampler and the Regular Expression Extractor.  I
> have no problem getting the values I need/want/expect from the Regex,
> but I can't seem to add numbers together, and I can't seem to figure out
> *WHERE* the calculations should go.
> >
> >  The simplest sample I've come up with looks like this:
> >
> >  Test Plan
> >  + Thread Group
> >   - User Defined Variables
> >   - Debug Sampler
> >   - View Results Tree
> >  Workbench
> >
> >  In User Defined Variables, I have:
> >
> >  Name    Value
> >  ======  ================================
> >  var1    __eval(30 + 6)
> 
> __eval() does not evaluate numeric expressions.
> 
> You can use intSum() for adding/subtracting numbers, otherwise use Jexl.
> 
> >  var2    ${__eval(30 + 6)}
> >  var3    10 / 4
> >  var4    ${__eval(10 / 4)}
> >  var5    ${__time(YMD)}
> >  column  uname
> >  table   users
> >  sql     SELECT ${column} FROM ${table}
> >
> >  The output I see from the Debug Sampler is NOT what I'd expect:
> >
> >  var1 = __eval(30 + 6)
> >  var2 = ${__eval(30 + 6)}
> >  - I was hoping to get "36"
> >
> >  var3 = 10 / 4
> >  var4 = ${__eval(10 / 4)}
> >  - I was hoping to get "2"
> >
> >  var5 = ${__time(YMD)}
> >  - I was hoping to get "20080410"
> >
> >  column = uname
> >  table = users
> >  sql = SELECT ${column} FROM ${table}
> >  I was hoping to get "SELECT uname FROM users"
> 
> UDV variables are not defined until the entire element has been
> processed.
> If you put sql in a separate UDV it should work.
> 
> >  It may be the case that User Defined Variables is just a convenience
> component which makes it easier to define variables than it would be to
> import them from a text file and that my use of this component is
> wayward/errant.  However, I don't know where the heck to put this stuff
> if this is the wrong place.
> >
> >  Further, I don't seem to be able to get the expected values when I
> put these types of expressions in other components... UNLESS I put them
> in the title.  The ${__time(YMD)} works great if I put it in a COMPONENT
> LABEL (ie.- I name that component "Today is ${__time(YMD)}" I'll see
> "Today is 20080410" in the results), but doesn't want to do what I'm
> expecting when I stick it anywhere else.  That makes absolutely no sense
> to me.  How/what am I not understanding?
> 
> It should work almost anywhere.
> 
> >
> >  I'd greatly appreciate any guidance/ pointers/ references to anything
> that'll help me accomplish this.
> >
> >  Regards,
> >
> >
> >  - Dan
> >
> >
> >  __________________________________________________
> >  Do You Yahoo!?
> >  Tired of spam?  Yahoo! Mail has the best spam protection around  
> > http://mail.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 

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

Reply via email to