>1. Is it possible to call entire Javascript function in Jmeter? if yes How
>to acheive this?
probably not. Not only do you want to execute javascript - you want to
emulate Jquery's $.ajax method
Jmeter is not a browser etc etc http://jmeter.apache.org/

But then this is not the way you'd testyour scenario in Jmeter..

regards
deepak




On Wed, Aug 1, 2012 at 11:42 PM, madhu sekhar <[email protected]>wrote:

> Explained the issue little more:
>
> Working on Autocomplete Jmeter Testing task with Jmeter 2.5.1
>
> Problem:
>
> Internally the Autocomplete process is handling by Javascript Function with
> some ajax calls.
> This JavaScript function accepts 2 parameters
> a)  form Name
> b)  url with some paramets & sid
>
> Here is the JavaScript Function code and this will be included under the
> script tag as metnioned below
>
> http://xxxxxxxx:xxxx/current/javascript/components/AC/AutoComplete.js
>
> Her is the content of AutoComplete.js
> ==============================
> // the initial function that gets called in the body onload to enable AC
> function enableAutoComplete(formName, acUrl) {
>     $('form[name="' + formName + '"]
> input:text').live('keyup.autocomplete', function(){
>         $(this).autocomplete({
>             source: function( request, response ) {
>                 $.ajax({
>                     url: acUrl,
>                     dataType: "json",
>                     data: {
>                         style: "full",
>                         maxRows: 10,
>                         term: request.term
>                     },
>                     success: function( data ) {
>                         response(
>                                 $.map( data,
>                                         function( count, key ) {
>                                             return {
>                                                 label: key,
>                                                 value: key
>                                             }
>                                         }
>                                 )
>                         );
>                     },
>                     error: function() {
>                         //TODO: add log
>                     }
>                 });
>             },
>             minLength: 3,
>             open: function() {
>                 $( this ).removeClass( "ui-corner-all" ).addClass(
> "ui-corner-top" );
>             },
>             close: function() {
>                 $( this ).removeClass( "ui-corner-top" ).addClass(
> "ui-corner-all" );
>             }
>         });
>     });
> }
> ==============================
> My Question are
>
> 1. Is it possible to call entire Javascript function in Jmeter? if yes How
> to acheive this?
>
> 1. How to pass 2 parametes to the Javascript function using Post Processor
> or pre processor?
>
> 2. How to use the return value of Javascript function as paramer for html
> request?
>
> On Wed, Aug 1, 2012 at 6:30 PM, Adrian Speteanu <[email protected]>
> wrote:
>
> > I would use the beanshell pre-processor. BS / BSF allows you to enter a
> > code snippet, java being my choice. So you use vars.get(); and
> vars.put();
> > methods to get and update jmeter runtime variables. In the beanshell you
> > use whatever code logic you need in order to extend the functionality of
> > your test plan (which, with normal jmeter GUI elements is somewhat
> > limited).
> >
> > I only use it when there is no alternative using default elements from
> > jmeter or when I need some functionality available in a larger library, a
> > .jar that is placed in jmeter's lib folder.
> >
> > Look it up in jmeter's manual, maybe you find something that relates to
> > you.
> >
> > The purpose is to have something that allows you to replicate ajax
> > processing, which is client side. Keep it to a must-have basis though,
> most
> > requests can be replicated without duplicating client side logic.
> >
> > --Adrian S
> >
> > On Wed, Aug 1, 2012 at 3:48 PM, madhu sekhar <[email protected]
> > >wrote:
> >
> > > Could you please explain me how BSF pre processor works in deeply?
> > >
> > > How to give function(syntax) at parameter value.
> > >
> > > On Wed, Aug 1, 2012 at 6:10 PM, Adrian Speteanu <[email protected]>
> > > wrote:
> > >
> > > > Well, you'll still need to make http request for each ajax call made
> in
> > > > real application.
> > > > So create 1 http sampler that makes a correct request and in query
> > > > parameter, use a variable.
> > > > Add a beanshell preprocessor in order to gradually increment the
> value
> > of
> > > > the variable (for "smith" it will be s on first run, sm on second
> run,
> > > smi
> > > > on third run and so on). Now how to approach this is up to you. I
> would
> > > > define the search term in a User Defined Variable and in the
> > > pre-processor
> > > > I would brake the word in its characters and gradually create a new
> > > string
> > > > with as many characters as needed. This allows you to enter a
> different
> > > > word without changing the http sampler or the pre-processor.
> > > >
> > > > Does this relate to what you have in mind? (frankly, i'm not sure I
> > > > understood perfectly what is not working for you...)
> > > >
> > > > It should work with a value previously extracted (and dynamic) which
> is
> > > > passed to the sampler's pre-processor.
> > > >
> > > > --Adrian S
> > > >
> > > > On Wed, Aug 1, 2012 at 3:22 PM, madhu sekhar <
> [email protected]
> > > > >wrote:
> > > >
> > > > > We need to make dynamic *auto complete* step in a test.
> > > > >
> > > > > We have the the parameter as *term=smith* at sampler of the same
> step
> > > of
> > > > > test .
> > > > >
> > > > > We need make the term as dynamic. I tired using post processor
> > (regular
> > > > exp
> > > > > extractor), But in HTML content we are not founded the parameter in
> > > > related
> > > > > URL.
> > > > >
> > > > > But we got the same in JavaScript of autocomplete method.
> > > > >
> > > > > Could anybody please suggest me, How to proceed further to make it
> as
> > > > > dynamic.
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > madhu kk
> > >
> >
>
>
>
> --
> madhu kk
>

Reply via email to