SPONSORS:






View RSS Feed

Ronak

Understanding JMeter - BeanShell Sampler

Rate this Entry
by , 06-21-2015 at 02:14 AM (698 Views)
Understanding JMeter - BeanShell Sampler

This sampler allows you to write a sampler using the BeanShell scripting language.
The test element supports the ThreadListener and TestListener interface methods. These must be defined in the initialisation file. See the file BeanShellListeners.bshrc for example definitions.

From JMeter version 2.5.1, the BeanShell sampler also supports the Interruptible interface. The interrupt() method can be defined in the script or the init file.

Parameters
Name- Descriptive name for this sampler that is shown in the tree. The name is stored in the script variable Label
Reset bsh.Interpreter before each call- If this option is selected, then the interpreter will be recreated for each sample. This may be necessary for some long running scripts.
Parameters- Parameters to pass to the BeanShell script. This is intended for use with script files; for scripts defined in the GUI, you can use whatever variable and function references you need within the script itself. The parameters are stored in the following variables:
Parameters - string containing the parameters as a single variable
bsh.args - String array containing parameters, split on white-space

Script file- A file containing the BeanShell script to run. The file name is stored in the script variable FileName

Script- The BeanShell script to run. The return value (if not null) is stored as the sampler result.
Each Sampler instance has its own BeanShell interpeter, and Samplers are only called from a single thread
If the property "beanshell.sampler.init" is defined, it is passed to the Interpreter as the name of a sourced file. This can be used to define common methods and variables. There is a sample init file in the bin directory: BeanShellSampler.bshrc.
If a script file is supplied, that will be used, otherwise the script will be used.



Disclaimer: The article/post is posted with the purpose of sharing knowledge and information.
The article may contain references, extract or content from other informative sources.
Researched/Authored/Compiled by -
Ronak Shah
Practice Head - Software Testing (QA), CIGNEX Datamatics

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 10:40 PM.

Copyright BetaSoft Inc.