You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Kshitij Barve <ks...@yahoo.com> on 2009/11/11 11:25:32 UTC

How to Write a user defined function in JMeter and call it in the test plan

Hi,

I want to write an user defined function in JMeter. And would like to use it
in my test plan. Any pointers or example will help me a lot.

Regards,
Kshitij

-- 
View this message in context: http://old.nabble.com/How-to-Write-a-user-defined-function-in-JMeter-and-call-it-in-the-test-plan-tp26299085p26299085.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: How to Write a user defined function in JMeter and call it in the test plan

Posted by sebb <se...@gmail.com>.
On 12/11/2009, Kshitij Barve <ks...@yahoo.com> wrote:
>
>  Hi,
>  I want to write an user defined function to check if data bases are
>  synchronized or not. Here is the brief -
>
>  There are 2 databases - Master and Slave. All Write methods writes to Master
>  database, and all read methods points to slave. Slave gets updated after
>  every 2 seconds. So if I try to get the record that I have created recently,
>  then I don't get it. Because record is yet not available on Slave for read.
>  To overcome this, I have written a BeanShell sampler. But I have to use the
>  same code everywhere.
>  So a function will definitely help me in this case.

You probably need a sampler rather than a function.

>  Modify logic at one place and you are done.

So create a BeanShell script file and use the file rather than the
script field in the GUI.

Or create a BeanShell init script containing a suitable method and
load it via the property:

beanshell.sampler.init=<scriptname>

>  Any pointers will definitely help me.

This is described in the manual.

>  Regards,
>  Kshitij
>
>
>  sebb-2-2 wrote:
>  >
>  > On 11/11/2009, Kshitij Barve <ks...@yahoo.com> wrote:
>  >>
>  >>  Hi,
>  >>
>  >>  I want to write an user defined function in JMeter. And would like to
>  >> use it
>  >>  in my test plan. Any pointers or example will help me a lot.
>  >
>  > The source code is available and provides lots of examples, see:
>  >
>  > http://svn.apache.org/repos/asf/jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/
>  >
>  > or have a look at the files in the source download archive.
>  >
>  > It would help the mailing list if you could provide brief details as
>  > to what the function needs to do - maybe someone else has already
>  > implemented it.
>  >
>  >>  Regards,
>  >>  Kshitij
>  >>
>  >>
>  >>  --
>  >>  View this message in context:
>  >> http://old.nabble.com/How-to-Write-a-user-defined-function-in-JMeter-and-call-it-in-the-test-plan-tp26299085p26299085.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
>  >
>  >
>  >
>
>
> --
>  View this message in context: http://old.nabble.com/How-to-Write-a-user-defined-function-in-JMeter-and-call-it-in-the-test-plan-tp26299085p26313872.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


Re: How to Write a user defined function in JMeter and call it in the test plan

Posted by Kshitij Barve <ks...@yahoo.com>.
Hi,
I want to write an user defined function to check if data bases are
synchronized or not. Here is the brief -

There are 2 databases - Master and Slave. All Write methods writes to Master
database, and all read methods points to slave. Slave gets updated after
every 2 seconds. So if I try to get the record that I have created recently,
then I don't get it. Because record is yet not available on Slave for read.
To overcome this, I have written a BeanShell sampler. But I have to use the
same code everywhere. So a function will definitely help me in this case.
Modify logic at one place and you are done.

Any pointers will definitely help me.

Regards,
Kshitij

sebb-2-2 wrote:
> 
> On 11/11/2009, Kshitij Barve <ks...@yahoo.com> wrote:
>>
>>  Hi,
>>
>>  I want to write an user defined function in JMeter. And would like to
>> use it
>>  in my test plan. Any pointers or example will help me a lot.
> 
> The source code is available and provides lots of examples, see:
> 
> http://svn.apache.org/repos/asf/jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/
> 
> or have a look at the files in the source download archive.
> 
> It would help the mailing list if you could provide brief details as
> to what the function needs to do - maybe someone else has already
> implemented it.
> 
>>  Regards,
>>  Kshitij
>>
>>
>>  --
>>  View this message in context:
>> http://old.nabble.com/How-to-Write-a-user-defined-function-in-JMeter-and-call-it-in-the-test-plan-tp26299085p26299085.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
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-Write-a-user-defined-function-in-JMeter-and-call-it-in-the-test-plan-tp26299085p26313872.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: How to Write a user defined function in JMeter and call it in the test plan

Posted by sebb <se...@gmail.com>.
On 11/11/2009, Kshitij Barve <ks...@yahoo.com> wrote:
>
>  Hi,
>
>  I want to write an user defined function in JMeter. And would like to use it
>  in my test plan. Any pointers or example will help me a lot.

The source code is available and provides lots of examples, see:

http://svn.apache.org/repos/asf/jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/

or have a look at the files in the source download archive.

It would help the mailing list if you could provide brief details as
to what the function needs to do - maybe someone else has already
implemented it.

>  Regards,
>  Kshitij
>
>
>  --
>  View this message in context: http://old.nabble.com/How-to-Write-a-user-defined-function-in-JMeter-and-call-it-in-the-test-plan-tp26299085p26299085.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