Get Knowledge from Video instead of Content:

Monday, 30 January 2017

JMeter - Timer - "BeanShell Timer"

BeanShell Timer is a scripting-based timer. It means that you will need to implement the thread delay logic yourself using one of the supported scripting languages. Usually, it is helpful when you need to define think times based on some unique algorithm which is not currently provided by JMeter. You can create your own implementation of the algorithm using BeanShell timer.

How to add "BeanShell Timer" element?

You can follow below steps:
1. Select "Test Plan" or "Thread Group" or "Controller" or "Sampler" node where you want to add the timer
2. Right-click on the node
3. Mouse hovers "Add"
4. Mouse hovers "Timers"
5. Click "BeanShell Timer"

How to remove "BeanShell Timer" element?
You can follow below steps:
1. Select "BeanShell Timer" node
2. Right click on "BeanShell Timer" node
3. Click "Remove" (Mouse) or "Delete" button from the keyboard
4. Click "Yes"    

What are the attributes of "BeanShell Timer" element?

"BeanShell Timer" has following attributes:
  • 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.
Recommendation: It is recommended to use JSR223 timer and Groovy as a language. Groovy scripting is as fast as Java while BeanShell and JavaScript need to be interpreted, which causes some performance overhead. 

Next Topic:
Apache JMeter - "Constant Throughput Timer" Element

Previous Topic:
Apache JMeter - "Timer" Element

Related Topics:

No comments :

Post a Comment