BeanShell Assertion is a scripting-based Assertion element of JMeter. It means that you need to implement the assertion logic by yourself using one of the supported scripting languages. Usually, it is helpful when you need to define assertion or validation logic based on your requirement and want to write some unique algorithm which is not currently provided by JMeter. You can create your own implementation of the algorithm using BeanShell Assertion.
How to add ‘BeanShell Assertion’?
You can follow the below steps:
- Select the ‘Sampler’ element whose response needs to be validated
- Right-click on the sampler element
- Hover the cursor on ‘Add’
- Hover the cursor on ‘Assertions’
- Click ‘BeanShell Assertion’
Input Fields:
‘BeanShell Assertion’ has the following input fields:
- Name: To provide the name of the timer
- Comments: To provide arbitrary comments (if any)
- Reset bsh.Interpreter before each call: The interpreter will be recreated by selecting the value of this option as ‘Yes’.
- Parameters: Parameters to pass to the BeanShell script. This is an optional attribute.
- Script file: A file containing the BeanShell script to run. The return value is used as an assertion output generated by the BeanShell script.
- Script: The BeanShell script which contains the assertion logic.
You may be interested:
- Performance Testing Tutorial
- Performance Engineering Tutorial
- Micro Focus LoadRunner Tutorial
- NeoLoad Tutorial