Hi, With beanshell pre/post-processors all you will need to know is vars.put(); vars.get(); methods. From there, you can write whatever logic you need to run. Check out other threads on this list about them. Whatever logic you will need to execute will occur within the pre/post-processor as it would if it wouldn't be an external java piece of code, only that you need the vars.put(); to update jmeter with whatever values you needed to obtain. Read the documentation from jmeter user manual to see whatever other things you can use them for.
In beanshell, you can import whatever libraries you manually add to <jmeter_home>/lib folder. This is very useful, because the editor is difficult to use, so you can build a jar with whatever you need to run and do this in an IDE and then just call whatever methods you needed in the pre/post-processors. There are ways to import files from other locations too, but this is the fast start-up tip. Now, back to the dilemmas: 1. After you import whatever library are required, you can define any new object within the beanshell (read beanshell documentation for details on this). 2. I'm not quite sure, it should be the scope that variables in other pre/post-processor have... --Adrian S On Tue, Sep 25, 2012 at 7:57 AM, lichen970 <[email protected]> wrote: > Follow-ups: According to my test, if I initialize generator in a > postprocessor and try to reference it from a subsequent preprocessor, it > cannot recognize. Is there any way to create a random generator only once > and use it later one several times? > > > > -- > View this message in context: > http://jmeter.512774.n5.nabble.com/advices-about-how-to-construct-beanshell-scripts-tp5714889p5714890.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] > >
