You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Steve Kapinos <St...@tandberg.com> on 2008/03/27 14:01:56 UTC

Seting variables to an evaluated expression rather then a string?

This seems like such a simple topic, but I can't get it to work as
desired.

The need is to simply have a series of variables that are increments of
the first

A=100
B=A+1
C=B+1

Etc

This looks like a count, but the same value once set must be used
throughout the thread, so I want to set them as variables.  The starting
point of A is a semi-random value.

I've got an expression that works now, but it seems way complicated for
the need.  Is there a simplier way to do this?

Right now I have a User Parameter element setup like this

log1ID = ${__time(HMS)}
log2ID = ${intSum(${__V(${log1ID})},1,dummy)}

Can I define log2ID in some way to be a simple evaluated expression
rather then using the intSum function and needed that 'dummy' variable?

Thx

Steve

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


Re: Seting variables to an evaluated expression rather then a string?

Posted by sebb <se...@gmail.com>.
On 27/03/2008, Steve Kapinos <St...@tandberg.com> wrote:
> > I find  myself doing most text operations in the saved text files.  Am
>  I
>  > missing  something else there?
>
>  >Works fine for me - but you may need to double-click to enable the
>  field for input.
>
>
> Playing around more.. I see if I use control-c and control-v it works,
>  but using the Edit menu does not.  Do you see that behavior?  Jmeter
>  2.3.1 here
>

Agreed; the Edit menu does not work in fields.
It's only intended for use in the test plan tree.

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

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


RE: Seting variables to an evaluated expression rather then a string?

Posted by Steve Kapinos <St...@tandberg.com>.
> I find  myself doing most text operations in the saved text files.  Am
I 
> missing  something else there?

>Works fine for me - but you may need to double-click to enable the
field for input.

Playing around more.. I see if I use control-c and control-v it works,
but using the Edit menu does not.  Do you see that behavior?  Jmeter
2.3.1 here



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


Re: Seting variables to an evaluated expression rather then a string?

Posted by sebb <se...@gmail.com>.
On 27/03/2008, Steve Kapinos <St...@tandberg.com> wrote:
> >  log2ID = ${intSum(${__V(${log1ID})},1,dummy)}
>
>  > That won't work as the function is called __intSum, not intSum.
>
>
> Yes, typo on my part when trying to transcribe the screen since I can't
>  seem to copy/paste text fields from the applet in windows.  I find
>  myself doing most text operations in the saved text files.  Am I missing
>  something else there?
>

Works fine for me - but you may need to double-click to enable the
field for input.

>  For instance, when trying to put large XML blocks into my samplers.. I
>  can't copy/paste into the sampler's body field.  I open the test plan in
>  a text editor and manually insert it into the xml structure.
>
>
>  > Use one of the script functions (Javascript, Jexl, BeanShell) to do
>  the calculation, e.g.
>  ${__jexl(${log1ID}+1)}
>
>
> Thanks - that was kind of what I was looking for.
>
>
>  -Steve
>
>
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

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


RE: Seting variables to an evaluated expression rather then a string?

Posted by Steve Kapinos <St...@tandberg.com>.
>  log2ID = ${intSum(${__V(${log1ID})},1,dummy)}

> That won't work as the function is called __intSum, not intSum.

Yes, typo on my part when trying to transcribe the screen since I can't
seem to copy/paste text fields from the applet in windows.  I find
myself doing most text operations in the saved text files.  Am I missing
something else there?

For instance, when trying to put large XML blocks into my samplers.. I
can't copy/paste into the sampler's body field.  I open the test plan in
a text editor and manually insert it into the xml structure.

> Use one of the script functions (Javascript, Jexl, BeanShell) to do
the calculation, e.g.
${__jexl(${log1ID}+1)}

Thanks - that was kind of what I was looking for.

-Steve



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


Re: Seting variables to an evaluated expression rather then a string?

Posted by sebb <se...@gmail.com>.
On 27/03/2008, Steve Kapinos <St...@tandberg.com> wrote:
> This seems like such a simple topic, but I can't get it to work as
>  desired.
>
>  The need is to simply have a series of variables that are increments of
>  the first
>
>  A=100
>  B=A+1
>  C=B+1
>
>  Etc
>
>  This looks like a count, but the same value once set must be used
>  throughout the thread, so I want to set them as variables.  The starting
>  point of A is a semi-random value.
>
>  I've got an expression that works now, but it seems way complicated for
>  the need.  Is there a simplier way to do this?
>
>  Right now I have a User Parameter element setup like this
>
>  log1ID = ${__time(HMS)}
>  log2ID = ${intSum(${__V(${log1ID})},1,dummy)}

That won't work as the function is called __intSum, not intSum.

>

log2ID = ${__intSum(${log1ID},1,dummy)}

is a bit simpler and should work.

>  Can I define log2ID in some way to be a simple evaluated expression
>  rather then using the intSum function and needed that 'dummy' variable?

[It would be possible to make the variable parameter optional for the
special case of two integers as "intSum(number,variable)" does not
make much sense. Variable names can be composed of digits only, so
there's no way of knowing for the general case - unless one insists
that the variable name start with a non-digit.]

Use one of the script functions (Javascript, Jexl, BeanShell) to do
the calculation, e.g.

${__jexl(${log1ID}+1)}

but of course using script functions will necessarily increase the
overhead somewhat.

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

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