jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Melnyk <melnykena...@gmail.com>
Subject Re: BeanShell PreProcessor question
Date Mon, 29 Mar 2010 16:47:46 GMT
Thanks Deepak got it working as i was expected.

2010/3/29 Deepak Shetty <shettyd@gmail.com>

> Hi
> yep so since your pre processor is a child of the thread group it will be
> executed before element of the threadgroup. You could create it as a child
> of the first http sampler (or a dummy test action sampler which appears
> once).
> There is a section on scoping of various elements etc in the manual ..
> regards
> deepak
>
> On Mon, Mar 29, 2010 at 9:39 AM, Andrew Melnyk <melnykenator@gmail.com
> >wrote:
>
> > I've uploaded both screen shot of the test plan and jmx :
> > The screen shot: http://rapidshare.com/files/369605123/TestPlan.jpg.html
> > The test plan: http://rapidshare.com/files/369605730/BeanShell.jmx.html
> >
> > I'm continuing to play with it.
> >
> > 2010/3/29 Deepak Shetty <shettyd@gmail.com>
> >
> > > Attachments dont come through. you will have to upload somewhere and
> post
> > a
> > > link. Like I said you probably need to create this pre processor as a
> > child
> > > of the first sampler..
> > >
> > > regards
> > > deepak
> > >
> > > On Mon, Mar 29, 2010 at 9:27 AM, Andrew Melnyk <melnykenator@gmail.com
> > > >wrote:
> > >
> > > > Deepak you are right,  it looks like it is executed for every Sampler
> > in
> > > my
> > > > case for every Search.
> > > > I''ve attached my test plan.
> > > >
> > > > 2010/3/29 Deepak Shetty <shettyd@gmail.com>
> > > >
> > > > I think your question is you are using ${randomword} in 3 samplers
> and
> > > the
> > > >> first two are the same but the third one differs and you need to use
> > the
> > > >> same value for all 3 samplers?
> > > >> If so I would assume that your pre processor got executed again .
If
> > > your
> > > >> preprocessor is not the child of a sample and is instead the child
> of
> > > some
> > > >> controller it might be getting executed before each sample
> > > >>
> > > >> regards
> > > >> deepak
> > > >>
> > > >> On Mon, Mar 29, 2010 at 8:56 AM, Andrew Melnyk <
> > melnykenator@gmail.com
> > > >> >wrote:
> > > >>
> > > >> > Gentlemen,
> > > >> >
> > > >> > I'm seeing an interesting issue I have following code in the
> > > >> > BeanShellPreProcessor :
> > > >> >
> > > >> > The idea is to get new random word every time from the array
> > > >> >
> > > >> > // array of Strings
> > > >> > String[] args={"Test", "Test1","Test2"};
> > > >> >
> > > >> > // This is an random element i'm going to extract from the array
> > > >> > int randomElement = (int)(Math.random() * (args.length - 1));
> > > >> >
> > > >> > // This is just for debugging purpose, initialization of test
plan
> > > >> variable
> > > >> > vars.put("randomElement", randomElement.toString());
> > > >> >
> > > >> > // randomword i'll use in some search scenarios
> > > >> > vars.put("randomword", args[randomElement] );
> > > >> >
> > > >> > What i have as result of the code above:
> > > >> >
> > > >> > After the BeanShellPreProcessor is executed my variables
> looks(from
> > > >> Debug
> > > >> > Sampler):
> > > >> >
> > > >> > randomElement=1
> > > >> > randomword=Test1 ,  OK that is what i was looking for
> > > >> >
> > > >> > Then in my scripts randomword is used three times in search
> > scenarios:
> > > >> >
> > > >> > In first two searches referencing to randomword results a "Test1"
> > > string
> > > >> > which is OK but in the third search instead of "Test1" I'm seeing
> > > "Test"
> > > >> > can
> > > >> > anyone explain why this happens? Or there is something wrong
in
> > > >> > implementation?
> > > >> >
> > > >> > --
> > > >> > Regards,
> > > >> > Andriy
> > > >> >
> > > >>
> > > >
> > > >
> > > >
> > > > --
> > > > Regards,
> > > > Andriy
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> > > >
> > >
> >
> >
> >
> > --
> > Regards,
> > Andriy
> >
>



-- 
Regards,
Andriy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message