Bastian Bastian - 3 years ago 192
Groovy Question

vars.get command in groovy verification - jmeter

In documentation mentioned that to see/pass variable content we should use

var2 = vars.get("var1");

I created a script and tried to use this get function and the value is
, when I printed the value of the "source" variable I see its value, can someone please explain? (as you can see when I print using get I see

Moreover can someone please fully explained (with PIC if I may ask) how to call
in a second sampler, I am facing an issues with variables in groovy and read the DOCs


enter image description here

enter image description here

Answer Source

vars.get can handle only String and not other objects as Integer,

You need to put the value of Integer using putObject, First groovy:

def old_budget = 137000000
vars.putObject("old_budget", old_budget);

You need to put the value of Integer using getObject, Second groovy:

def old_budget = vars.getObject("old_budget");;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download