What is BeanShell scripting?

BeanShell is one of the most advanced JMeter built-in components. BeanShell is a lightweight Java scripting language that JMeter uses to do some sophisticated tasks. With the help of coding, the BeanShell sampler can execute a variety of tasks. You can get the thread number, run the current sampler, collect the cookies, and so forth. It comprehends Java syntax and provides scripting features such as loose types, commands and method closures. BeanShell can be a wonderful solution to achieve your goals if your test case is peculiar and creating it using embedded JMeter components is nearly impossible. BeanShell entities in JMeter include accessibility both to internal JMeter APIs as well as any external classes packed into the JMeter classpath (make sure to drop appropriate jars into your JMeter installation's /lib/ext folder and place the relevant "import" statements at the top of your BeanShell scripts).

The following BeanShell-enabled components are available in all JMeter versions :

* Beanshell Sampler : A sampler that can operate independently.
* Beanshell PreProcessor : A sampler pre-processor that operates before the sampler and can be used to establish prerequisites (i.e. to generate some input).
* Beanshell PostProcessor : A post-processor that runs after the sampler and can be used for cleanup or recovery.
* Beanshell Assertion : A powerful assertion that allows you to use the JMeter API completely. Java conditional logic can be used to control the outcome of the assertion.
* __Beanshell Function : A JMeter function that permits custom BeanShell code to be executed while the sampler is running.