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:27:56 GMT
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

Mime
View raw message