Hi, friends,

I am currently seeking a way to integrated one java function into my
testplan. The java function is to give back a number that is exponentially
distributed in a range, i.e. int getExp_int(Random generator, double mean,
int upper), where generator should be initialized(only once) at very first
and upper is the upper-bound of the range, 0 is the lower-bound. 

My scenario is: page1 execute one time and then several times access to
page2. page1 outputs the value of upper, and then I want jmeter to access
page2 several times, each time I will use a unique value returned by
get_Exp_int() functions as part of my new request. You can simply assume
this value is a ID of a user article, photo, etc. Here I have two questions:

1. where should I put initialization code like "Random generator= new
Random()" so that all the subsequent calls to get_Exp_int() from can pass it
as argument? Just not sure about how many beanshell interpreter instance
will exist within a test...and if I run Random generator= new Random() in a
beanshell postprocessor after page1, will the generator visible to a
beanshell preprocessor before page2?

2. What is the scope of a beanshell? Per thread? Per thread group? or Per
testplan? Namely, one beanshell for one thread, one thread group or one
testplan? Ideally, I will login to different user acounts, and they all have
different value of "upper", and I want to get a series of number following
exponential distribution for each user. Is this possible? or I have to run
multiple jmeter instance, with each of them act ast only one user so that I
can ensure the distribution. 

Sorry for the long narration but I really feel it's hard to understand
beanshell in jmeter context. Thanks.



--
View this message in context: 
http://jmeter.512774.n5.nabble.com/advices-about-how-to-construct-beanshell-scripts-tp5714889.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to