当前位置:网站首页>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 !
边栏推荐
- Natural language processing (NLP) - third party Library (Toolkit):allenlp [library for building various NLP models; based on pytorch]
- Recursive method converts ordered array into binary search tree
- How to make your own robot
- [pat (basic level) practice] - [simple mathematics] 1062 simplest fraction
- [groovy] XML serialization (use markupbuilder to generate XML data | set XML tag content | set XML tag attributes)
- NLP generation model 2017: Why are those in transformer
- 1791. Find the central node of the star diagram / 1790 Can two strings be equal by performing string exchange only once
- 看抖音直播Beyond演唱会有感
- 视频直播源码,实现本地存储搜索历史记录
- Arduino hexapod robot
猜你喜欢
BiShe - College Student Association Management System Based on SSM
Recoverable fuse characteristic test
The growth path of test / development programmers, the problem of thinking about the overall situation
Finding the nearest common ancestor of binary search tree by recursion
JVM_ 15_ Concepts related to garbage collection
Fibonacci number
How to make your own robot
Intensive learning weekly, issue 52: depth cuprl, distspectrl & double deep q-network
猿桌派第三季开播在即,打开出海浪潮下的开发者新视野
KDD 2022 | 脑电AI助力癫痫疾病诊断
随机推荐
Model analysis of establishment time and holding time
vSphere实现虚拟机迁移
The detailed page returns to the list and retains the original position of the scroll bar
Hundreds of lines of code to implement a JSON parser
The inconsistency between the versions of dynamic library and static library will lead to bugs
Zhuhai's waste gas treatment scheme was exposed
Five challenges of ads-npu chip architecture design
Interview must brush algorithm top101 backtracking article top34
Cve-2017-11882 reappearance
Overview of Zhuhai purification laboratory construction details
golang mqtt/stomp/nats/amqp
Mysql--- query the top 5 students
Dede collection plug-in free collection release push plug-in
测试/开发程序员的成长路线,全局思考问题的问题......
MYSQL---查询成绩为前5名的学生
[groovy] compile time metaprogramming (compile time method interception | find the method to be intercepted in the myasttransformation visit method)
KDD 2022 | 脑电AI助力癫痫疾病诊断
Beginner redis
MCU realizes OTA online upgrade process through UART
Kotlin core programming - algebraic data types and pattern matching (3)