BeanShell Sampler
BeanShell
Introduction:is a scripting language that conforms fully to the Java syntax specification and has its own syntax and methods; it is a loosely typed scripting language that executes standard Java statements and expressions, and it also includes script commands and syntax
Jmeter
What are the BeanShell
:
Timer: BeanShell Timer
Front Processor: BeanShell preprocessor
Post Processor: BeanShell postprocessor
Sampler: BeanShell Sampler
Assertion: BeanShell Assertion
Listener: BeanShell Listener
Action variables: VARs with built-in objects
Access to variables
Vars.get ("Phoneno") gets the value of the variable from the JMeter
Vars.put ("Key", "value") data stored in the JMeter variable
BeanShell Sampler Script Writing
In the test plan, add a variable User=wang
In the thread group, add a variable test=ddd
Debug Sampler-1 and Debug Sampler-2 are used to compare the results before and after BeanShell processing, and the script
Run results
referencing external Java file
Source ("Java file path");
For example: Source ("C:\\users\\administrator\\desktop\\test.java");
referencing external class file
Addclasspath ("path"), and then import the package and class
introducing an external jar Package
Place the jar package under the JMeter installation directory \ Apache-jmeter-3.1\lib\ext, and then test the plan to the right of the bottom of the bread directly add the reference jar package,
Finally, import the jar package in the script
BeanShell sampler-- Incoming parameter Transfer
Define three variables: a,b,c, then enter at parameter: ${a} ${b} ${c}, with spaces in the middle,
Run the results,
JMeter Common script Development BeanShell Sampler