当前位置:网站首页>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 !
边栏推荐
- logstash清除sincedb_path上传记录,重传日志数据
- Cf:h. maximum and [bit operation practice + K operations + maximum and]
- MIT doctoral thesis | robust and reliable intelligent system using neural symbol learning
- What is the most suitable book for programmers to engage in open source?
- Mysql--- query the top 5 students
- SSH login is stuck and disconnected
- Gartner发布2022-2023年八大网络安全趋势预测,零信任是起点,法规覆盖更广
- cf:H. Maximal AND【位运算练习 + k次操作 + 最大And】
- NLP basic task word segmentation third party Library: ICTCLAS [the third party library with the highest accuracy of Chinese word segmentation] [Chinese Academy of Sciences] [charge]
- Pbootcms plug-in automatically collects fake original free plug-ins
猜你喜欢

MobileNet系列(5):使用pytorch搭建MobileNetV3并基于迁移学习训练

从 1.5 开始搭建一个微服务框架——调用链追踪 traceId

esxi的安装和使用

Intensive learning weekly, issue 52: depth cuprl, distspectrl & double deep q-network

VSphere implements virtual machine migration

Dedecms plug-in free SEO plug-in summary

Mobilenet series (5): use pytorch to build mobilenetv3 and learn and train based on migration

Finding the nearest common ancestor of binary tree by recursion

Cve-2017-11882 reappearance

After 95, the CV engineer posted the payroll and made up this. It's really fragrant
随机推荐
How to extract MP3 audio from MP4 video files?
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
[groovy] JSON serialization (jsonbuilder builder | generates JSON string with root node name | generates JSON string without root node name)
vSphere实现虚拟机迁移
Promise
Introduction to robotics I. spatial transformation (1) posture, transformation
C language programming (Chapter 6 functions)
如何制作自己的机器人
测试/开发程序员的成长路线,全局思考问题的问题......
Leetcode study - day 35
DD's command
MIT博士论文 | 使用神经符号学习的鲁棒可靠智能系统
After Luke zettlemoyer, head of meta AI Seattle research | trillion parameters, will the large model continue to grow?
Dede collection plug-in free collection release push plug-in
Fibonacci number
在产业互联网时代,将会凭借大的产业范畴,实现足够多的发展
云导DNS和知识科普以及课堂笔记
golang mqtt/stomp/nats/amqp
JVM_ 15_ Concepts related to garbage collection
[simple implementation of file IO]