BeanShell Assertion

JMeter – BeanShell Assertion

A JMeter assertion component called BeanShell Assertion uses scripts. It implies that you need to use one of the supported scripting languages to build the assertion logic yourself. This is generally useful when you need to create assertion or validation logic to suit your needs and you want to create a special algorithm that JMeter doesn’t yet offer. Using the BeanShell Assertion, you can design your own algorithm implementation.

How to add ‘BeanShell Assertion’?

You can follow the below steps:

  1. Select the ‘Sampler’ element whose response needs to be validated
  2. Right-click on the sampler element
  3. Hover the cursor on ‘Add’
  4. Hover the cursor on ‘Assertions’
  5. Click ‘BeanShell Assertion
JMeter - BeanShell Assertion

The input fields for “BeanShell Assertion” are as follows:

Name: to specify the name of the timer

Leave any comment random.

Restart the bsh. For each conversation, the interpreter: If you select the ‘Yes’ option for this option, a new interpreter will be created.

Parameters: Passed as parameters to the BeanShell script. This quality is optional.

Text File: A file that contains the BeanShell script to run. The return value of the BeanShell script is used as the assert output.

Script: The assertion logic is contained in the BeanShell script.

Scroll to Top