Grzegorz Kończyk
2008-04-07 14:01:58 UTC
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} );
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 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.
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?
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} );
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 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.
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?