below are the steps i followed, 1) Added a BeanShell sampler and add a Bean Shell Preprocessor to the same sampler.
long c = 25478995L;
log.info(c + " - It is long");
vars.put("c",c)
2) I am trying to print the value c in Bean Shell sampler like below,
${c}
3) But when i see in view result tree i am getting the ${c} instead i am expecting to view 25478995.
Can any one help me please. Thanks in advance.
Regards, Hari
If you want to store a Long per se you need to use vars.putObject() function instead like:
vars.putObject("c", c);
and later on:
log.info("My long value is: " + vars.getObject("c"));
If you want to have String representation - you need to convert your Long to String first like:
vars.put("c", Long.toString(c));
${c}
in scripts, use vars.get("c");
or vars.getObject("c");
instead