JMeter BeanShell Timer is a scripting-based timer. It means that you have to implement the thread delay logic by yourself using one of the supported scripting languages. Usually, it is helpful when you need to define think time based on some unique algorithm which is not currently provided by JMeter. You can implement your own algorithm using BeanShell timer.
How to add ‘BeanShell Timer’ in JMeter script?
Follow the below steps to add BeanShell Timer:
- Select the appropriate node where you want to add the time
- Test Plan
- Thread Group
- Right-click on the node
- Hover the mouse on ‘Add’
- Hover the mouse on ‘Timers’
- Click ‘BeanShell Timer’
What are the input fields of ‘BeanShell Timer’?
- Name: To provide the name of the timer
- Comments: To provide arbitrary comments (if any)
- Reset bsh.Interpreter before each call: 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 the number of milliseconds to wait.
- Script: The BeanShell script which contains the logic to generate think time. The return value is used as the number of milliseconds to wait.