You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by l_u_c_f_e_r_13 <sy...@globallogic.com> on 2008/10/23 08:19:06 UTC

Jmeter function in Bean Shell

Hi,
Could somebody tell me how can I use some Jmeter function in BeanShell
assertion.

For example I want to use __regexpFunction() in BeanShell assertion when,
lets say, SampleResult.getResponseDataAsString().contains("SOME_TEXT")=true.
So if there was an error on the page - I want get exception from response
using regexp.
For now I come up with following solution - set RegExp Extractor before
BeanShell assertion, and use that variable in assertion.
But it will be better if there is some way to avoid using of RegExp
Extractor, and use __regexpFunction() function directly in BeanShell
Assertion.

TIA
-- 
View this message in context: http://www.nabble.com/Jmeter-function-in-Bean-Shell-tp20124969p20124969.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: Jmeter function in Bean Shell

Posted by sebb <se...@gmail.com>.
On 23/10/2008, l_u_c_f_e_r_13 <sy...@globallogic.com> wrote:
>
>  Hi,
>  Could somebody tell me how can I use some Jmeter function in BeanShell
>  assertion.
>
>  For example I want to use __regexpFunction() in BeanShell assertion when,
>  lets say, SampleResult.getResponseDataAsString().contains("SOME_TEXT")=true.
>  So if there was an error on the page - I want get exception from response
>  using regexp.

Not sure I understand why you think you need BeanShell.

>  For now I come up with following solution - set RegExp Extractor before
>  BeanShell assertion, and use that variable in assertion.
>  But it will be better if there is some way to avoid using of RegExp
>  Extractor, and use __regexpFunction() function directly in BeanShell
>  Assertion.

Why is it better?

You can use any function or variable references that you like in the
BeanShell GUI script. They will be processed before the script is
passed to BeanShell. Or you can use them as parameters (in which case
it will also work with script files).

Otherwise, it's not easy to call functions from BeanShell as method
calls - you have to find out the class name, and set up all the
environment it expects. This is not going to be easy.

But there is no need, as BeanShell can do whatever the function does.

>  TIA
>
> --
>  View this message in context: http://www.nabble.com/Jmeter-function-in-Bean-Shell-tp20124969p20124969.html
>  Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  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