On 07/04/2008, Grzegorz Kończyk <[EMAIL PROTECTED]> wrote:
> My TestPlant looks like this:
>
>  TestPlant
>   |-User Defined Variable
>   |-HTTP Request
>     |-BeanShell PostProcessor
>
>  TestPlan settings are:
>  Number of threads: 1
>  Ramp-up: 1
>  Loop: 1
>
>  In User Defined Variable I have 2 variables defined:
>  offer = 100
>  step = 2
>
>  In BeanShell PostProcessor I have following script (print functions are only 
> for "debugging"):
>
>  print( ${offer} );

The variable reference is substituted before the script is run.

>  int of =  Integer.parseInt( vars.get("offer") );
>  int st = Integer.parseInt( vars.get("step") );
>  of = of + st;
>  String newVal = Integer.toString( of );
>  print( newVal);
>  vars.put( "offer", newVal );
>  print( ${offer} );

The variable reference is substituted before the script is run.

Try print(vars.get("offer"));

>  The console output (black cmd window opened while starting JMeter) shows me 
> following results:
>
>  100
>  102
>  100 - here is the error - why it's not 102 here?
>
>  AFAIK, vars.put( "offer", newVal ); should overwrite old value of "offer" 
> (100) with the new value (102), but it doesn't.

Yes it does.

>  I tried also another way:
>
>
>  import org.apache.jmeter.util.*;
>
>  print( ${offer} );
>  int of =  Integer.parseInt( vars.get("offer") );
>  int st = Integer.parseInt( vars.get("step") );
>  of = of +st;
>  String newVal = Integer.toString( of );
>  print( newVal);
>  JMeterUtils.setProperty( "offer", newVal );
>  print( ${offer} );
>
>  But it also gives me:
>
>  100
>  102
>  100 (why not 102 ??)
>
>  Any ideas?

See above.

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

Reply via email to