You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Miklos Tverdota <tv...@axelero.hu> on 2005/08/08 16:00:18 UTC
User variables in Bean Shell
Hi,
The version is JMeter 2.0.3.
I use BeanShell from response assertion.
I have some user variables global direct as children of the thread
group. I already catch some response parameters with the reqular
expression extractors.
They are saved in User Variables. If some request is executed and the
result is fail, I want to write the session_id, custommer, and some
others parameters in the log file.
They are can be wrong constemer or some other problem. The test works
fine with some customers. I have a long customer list and I want ot pick
up the wrong ones.
It is not possible to track each of them.
To do this, I need the value of the variables. This is all about. I
could not find out how to get it. The context is passed to the Bean
Shell, but I am not able to use it.
I supposed it is possible to get the values simmilar to the response
parameters.
This code is from response assertion:
// Add variables for access to context and variables (no variable is transfered)
JMeterContext jmctx = JMeterContextService.getContext();
JMeterVariables vars = jmctx.getVariables();
bshInterpreter.set("ctx",jmctx); //$NON-NLS-1$
bshInterpreter.set("vars",vars);//$NON-NLS-1$
Jmeter use the same code everyvere to tranfer the ResposeCode and the
variables. Unfortunately I can use the ResponseCode but I can not reach
the User variables.
Thanks,
Miklos
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: User variables in Bean Shell
Posted by sebb <se...@gmail.com>.
On 08/08/05, Miklos Tverdota <tv...@axelero.hu> wrote:
> Hi,
>
> The version is JMeter 2.0.3.
> I use BeanShell from response assertion.
>
> I have some user variables global direct as children of the thread
> group. I already catch some response parameters with the reqular
> expression extractors.
> They are saved in User Variables. If some request is executed and the
> result is fail, I want to write the session_id, custommer, and some
> others parameters in the log file.
> They are can be wrong constemer or some other problem. The test works
> fine with some customers. I have a long customer list and I want ot pick
> up the wrong ones.
> It is not possible to track each of them.
>
> To do this, I need the value of the variables. This is all about. I
> could not find out how to get it. The context is passed to the Bean
> Shell, but I am not able to use it.
> I supposed it is possible to get the values simmilar to the response
> parameters.
>
> This code is from response assertion:
>
> // Add variables for access to context and variables (no variable is transfered)
> JMeterContext jmctx = JMeterContextService.getContext();
> JMeterVariables vars = jmctx.getVariables();
> bshInterpreter.set("ctx",jmctx); //$NON-NLS-1$
> bshInterpreter.set("vars",vars);//$NON-NLS-1$
>
> Jmeter use the same code everyvere to tranfer the ResposeCode and the
> variables. Unfortunately I can use the ResponseCode but I can not reach
> the User variables.
It does in the latest CVS, but in 2.0.3 there were some differences.
Check the Help file - I think that's accurate.
Try the nightly and see if the problem is fixed.
>
> Thanks,
>
> Miklos
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org