当前位置:网站首页>The basic usage of JMeter BeanShell. The following syntax can only be used in BeanShell
The basic usage of JMeter BeanShell. The following syntax can only be used in BeanShell
2022-07-06 01:04:00 【Amen's love】
One 、 background
BeanShell By java Compiling , Is a lightweight scripting language , It is also equivalent to a small free JAVA Source interpreter , Support for object-oriented scripting language features , It can also be embedded in JAVA In the source code , Can dynamically execute JAVA Source code and extends some features of scripting language .
Two 、BeanShell Bring your own grammar
// 1. Log printing
log.info(" This is my first beanshell");
log.error(" This is my first beanshell");
// 2. Variables within a thread It can be done by
vars.put("name"," Zhang San ");
String name = vars.get("name");
log.info("----- Thread variable name:"+name);
log.info(vars.get("age")==null?"20":vars.get("age"));
// 3. Add get global variables
props.put("_name"," Li Si ");
String _name = props.get("_name");
log.info("----- Global variables _name:"+_name);
// 4. Get the sampler in front
String preCode = prev.getResponseCode();
String preData = prev.getResponseDataAsString();
log.info(" Get the shape code of the previous sampler ---》"+preCode);
log.info(" Get the return value of the previous sampler ---》"+preData);
3、 ... and 、 quote java Code processing complex logic
3.1 Mode one direct writing java Code
public int add(int a,int b) {
int count = a+b;
return count;
}
log.info("-----------a+B="+add(1,2));
3.2 Mode two introduce .java file
// Mode two call .java file
source("D:/MainTest.java");
MainTest test = new MainTest();
log.info("-----------C+D="+test.add(2,2));
3.3 Mode three introduce .jar file
Failure !
边栏推荐
- FFT learning notes (I think it is detailed)
- Spark SQL null value, Nan judgment and processing
- Leetcode Fibonacci sequence
- Interview must brush algorithm top101 backtracking article top34
- 面试必刷算法TOP101之回溯篇 TOP34
- 云导DNS和知识科普以及课堂笔记
- 95后CV工程师晒出工资单,狠补了这个,真香...
- Hundreds of lines of code to implement a JSON parser
- 激动人心,2022开放原子全球开源峰会报名火热开启
- [groovy] JSON serialization (jsonbuilder builder | generates JSON string with root node name | generates JSON string without root node name)
猜你喜欢
Exciting, 2022 open atom global open source summit registration is hot
图解网络:TCP三次握手背后的原理,为啥两次握手不可以?
MYSQL GROUP_ The concat function realizes the content merging of the same ID
Convert binary search tree into cumulative tree (reverse middle order traversal)
95后CV工程师晒出工资单,狠补了这个,真香...
Finding the nearest common ancestor of binary tree by recursion
Mobilenet series (5): use pytorch to build mobilenetv3 and learn and train based on migration
Mlsys 2020 | fedprox: Federation optimization of heterogeneous networks
如何制作自己的机器人
Cve-2017-11882 reappearance
随机推荐
Zhuhai laboratory ventilation system construction and installation instructions
I'm interested in watching Tiktok live beyond concert
The relationship between FPGA internal hardware structure and code
curlpost-php
Cloud guide DNS, knowledge popularization and classroom notes
The population logic of the request to read product data on the sap Spartacus home page
Comment faire votre propre robot
如何制作自己的机器人
Dede collection plug-in free collection release push plug-in
95后CV工程师晒出工资单,狠补了这个,真香...
可恢复保险丝特性测试
FFT 学习笔记(自认为详细)
Cglib dynamic agent -- example / principle
在产业互联网时代,将会凭借大的产业范畴,实现足够多的发展
FFT learning notes (I think it is detailed)
Spark SQL null value, Nan judgment and processing
synchronized 和 ReentrantLock
[pat (basic level) practice] - [simple mathematics] 1062 simplest fraction
MCU realizes OTA online upgrade process through UART
Gartner released the prediction of eight major network security trends from 2022 to 2023. Zero trust is the starting point and regulations cover a wider range