Here's a useful tip for gaining finer control over your test plans. In
particular, for including BeanShell code at arbitrary points in your
tests. I'd love to hear of any similar or better ideas from other JMeter
users.
If you want to call BeanShell code before each execution of a Sampler,
put the code into an external file and add a User Parameters
Pre-Processor to the Sampler. In the Pre-Processor, check "Update Once
Per Iteration", and add a single variable. The name of the variable can
be anything, and the value ("User_1") should be
${__BeanShell(source("BeanShellSourceFile.bsh");,)}
This allows you to do things such as recalculate variables within a
loop.
Calling BeanShell code after each execution of a Sampler is simpler.
Just put the code into a BeanShell Assertion attached to the Sampler. I
have used this for tweaking Sampler results before the listener writes
them to a file.
These are the best approaches I have found. I initially thought of
different approaches, but they weren't satisfactory:
- The BeanShell Sampler would be useful, except that it adds an extra
sample point in your results -- not so good if all you wanted it to do
was calculate a variable or write a log message.
- The User Defined Variables component could be used in the same manner
as the User Parameters Pre-Processor, but it doesn't work in loops since
it's not called every time.
What we really need is a BeanShell Pre-Processor and a BeanShell
Post-Processor. These would be extremely useful. In fact, if we could
get a BeanShell Timer and especially a BeanShell Listener too, JMeter
would make a giant leap in usefulness and flexibility.
Cheerio,
Bennett.
--
Bennett McElwee
This communication, including any attachments, is confidential. If you are not
the intended recipient, you should not read it - please contact me immediately,
destroy it, and do not copy or use any part of this communication or disclose
anything about it. Thank you. Please note that this communication does not
designate an information system for the purposes of the Electronic Transactions
Act 2002.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]