You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Noel O'Brien <no...@newbay.com> on 2009/05/21 18:04:27 UTC
User Defined Beanshell Function
Hi All,
Is it possible to define a beanshell function that I can use throughout my test in the same way as the built in functions, e.g. instead of using ${__threadNum()}
I can use ${__encrypt("raw string")} ?
--
Regards,
Noel
Re: User Defined Beanshell Function
Posted by Noel O'Brien <no...@newbay.com>.
Thanks for your explanation of this Sebb, very insightful!
Sounds like a bit of work to make a native function, and to be honest ${__BeanShell(functionName())} would suit my needs perfectly.
Regards,
Noel
----- Original Message -----
From: "sebb" <se...@gmail.com>
To: "JMeter Users List" <jm...@jakarta.apache.org>
Sent: Thursday, 21 May, 2009 18:56:24 GMT +00:00 GMT Britain, Ireland, Portugal
Subject: Re: User Defined Beanshell Function
On 21/05/2009, Noel O'Brien <no...@newbay.com> wrote:
> Hi All,
>
> Is it possible to define a beanshell function that I can use throughout my test in the same way as the built in functions, e.g. instead of using ${__threadNum()}
> I can use ${__encrypt("raw string")} ?
You can define a Beanhell function in an init file such as
BeanShellFunction.bshrc,
but this will need to be invoked using __BeanShell(functionName())
It's not possible to register the BeanShell function as a "native" function.
However, you can of course create your own function, just make sure it
implements org.apache.jmeter.functions.Function
The package name must contain ".functions." but not ".gui." - see
jmeter.properties "classfinder.functions" for details.
The code would need to be put in a jar and stored in lib/ext.
> --
> Regards,
>
> Noel
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
--
Regards,
Noel
Re: User Defined Beanshell Function
Posted by sebb <se...@gmail.com>.
On 21/05/2009, Noel O'Brien <no...@newbay.com> wrote:
> Hi All,
>
> Is it possible to define a beanshell function that I can use throughout my test in the same way as the built in functions, e.g. instead of using ${__threadNum()}
> I can use ${__encrypt("raw string")} ?
You can define a Beanhell function in an init file such as
BeanShellFunction.bshrc,
but this will need to be invoked using __BeanShell(functionName())
It's not possible to register the BeanShell function as a "native" function.
However, you can of course create your own function, just make sure it
implements org.apache.jmeter.functions.Function
The package name must contain ".functions." but not ".gui." - see
jmeter.properties "classfinder.functions" for details.
The code would need to be put in a jar and stored in lib/ext.
> --
> Regards,
>
> Noel
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org