You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by sebb <se...@gmail.com> on 2006/07/18 01:25:12 UTC

Re: How can we pass objects created in one beanshell sampler to another

It should be possible to pass objects between sampler in the same
thread using JMeter variables.

However, JMeter variables can only be strings when using get() and put().

You need to use putObject() and getObject() to work with other classes.

e.g.

vars.putObject("date",new Date()):
...
vars.getObject("date");


On 30/06/06, Vikrant Sharma <xb...@yahoo.com> wrote:
> Hi Vitalie,
>
> Thanks for the reply.
>
> When i try to store the object into a variable (in first beanshell) using vars.put("varname", "value"); method, it does not complain about anything.
> But when I get it (in second beanshell) using vars.get("varname") method and try to cast it, it throws error.
> Further  when i dont cast it and try to print it. it just prints the name of that object as a normal String. SO I think when we set the object in the variable it is just set as a normal String and not as an object instance.
>
> For the second solution, yes i can serialize the object but as this is the performance script, storing and loading object's state will incur some more cost.
>
> Thanks & Regards
> Vikrant
>
> Vitalie Valache <Vi...@bnm.org> wrote: just some ideas..
> - maybe you can declare a global variable assign the object value to it and use it by casting in the second beanshell, not sure if jmeter variable can store objects but why not!
>
> or
> - save object  to a file using serialization if your object is supporting and load it from your second beanshell.
>
>
> --
> DISCLAIMER:
> Any e-mail messages from the National Bank of Moldova are sent in good faith, but shall not be binding nor construed as constituting any obligation on the part of the Bank.
> The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you received this in error, please contact the sender and delete the material from any computer.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------
> Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2ยข/min or less.
>

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