当前位置:网站首页>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 !
边栏推荐
- [groovy] XML serialization (use markupbuilder to generate XML data | set XML tag content | set XML tag attributes)
- 详细页返回列表保留原来滚动条所在位置
- 2020.2.13
- cf:D. Insert a Progression【关于数组中的插入 + 绝对值的性质 + 贪心一头一尾最值】
- MYSQL GROUP_ The concat function realizes the content merging of the same ID
- Building core knowledge points
- 程序员搞开源,读什么书最合适?
- Distributed base theory
- After 95, the CV engineer posted the payroll and made up this. It's really fragrant
- SSH login is stuck and disconnected
猜你喜欢
Introduction to robotics I. spatial transformation (1) posture, transformation
1791. Find the central node of the star diagram / 1790 Can two strings be equal by performing string exchange only once
I'm interested in watching Tiktok live beyond concert
Idea remotely submits spark tasks to the yarn cluster
毕设-基于SSM高校学生社团管理系统
Cf:d. insert a progression [about the insert in the array + the nature of absolute value + greedy top-down]
The third season of ape table school is about to launch, opening a new vision for developers under the wave of going to sea
vSphere实现虚拟机迁移
MobileNet系列(5):使用pytorch搭建MobileNetV3并基于迁移学习训练
Recoverable fuse characteristic test
随机推荐
A preliminary study of geojson
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
MIT doctoral thesis | robust and reliable intelligent system using neural symbol learning
猿桌派第三季开播在即,打开出海浪潮下的开发者新视野
MYSQL---查询成绩为前5名的学生
有谁知道 达梦数据库表的列的数据类型 精度怎么修改呀
可恢复保险丝特性测试
95后CV工程师晒出工资单,狠补了这个,真香...
FFT learning notes (I think it is detailed)
China Taiwan strategy - Chapter 8: digital marketing assisted by China Taiwan
朝招金安全吗 会不会亏损本金
devkit入门
synchronized 和 ReentrantLock
[groovy] JSON serialization (jsonbuilder builder | generates JSON string with root node name | generates JSON string without root node name)
MIT博士论文 | 使用神经符号学习的鲁棒可靠智能系统
Some features of ECMAScript
小程序容器可以发挥的价值
几百行代码实现一个 JSON 解析器
Illustrated network: the principle behind TCP three-time handshake, why can't two-time handshake?
Recursive method converts ordered array into binary search tree