当前位置:网站首页>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 !
边栏推荐
- WordPress collection plug-in automatically collects fake original free plug-ins
- 激动人心,2022开放原子全球开源峰会报名火热开启
- MIT博士论文 | 使用神经符号学习的鲁棒可靠智能系统
- View class diagram in idea
- Finding the nearest common ancestor of binary tree by recursion
- Leetcode study - day 35
- Free chat robot API
- Arduino六足机器人
- Natural language processing (NLP) - third party Library (Toolkit):allenlp [library for building various NLP models; based on pytorch]
- Live broadcast system code, custom soft keyboard style: three kinds of switching: letters, numbers and punctuation
猜你喜欢

The population logic of the request to read product data on the sap Spartacus home page

Introduction to robotics I. spatial transformation (1) posture, transformation

vSphere实现虚拟机迁移

After 95, the CV engineer posted the payroll and made up this. It's really fragrant

如何制作自己的機器人

从 1.5 开始搭建一个微服务框架——调用链追踪 traceId
![Cf:d. insert a progression [about the insert in the array + the nature of absolute value + greedy top-down]](/img/9e/c933f454a39d906a407e4d415f0b87.png)
Cf:d. insert a progression [about the insert in the array + the nature of absolute value + greedy top-down]

Questions about database: (5) query the barcode, location and reader number of each book in the inventory table

Cf:c. the third problem
![[groovy] JSON string deserialization (use jsonslurper to deserialize JSON strings | construct related classes according to the map set)](/img/bf/18ef41a8f30523b7ce57d03f93892f.jpg)
[groovy] JSON string deserialization (use jsonslurper to deserialize JSON strings | construct related classes according to the map set)
随机推荐
Installation and use of esxi
MobileNet系列(5):使用pytorch搭建MobileNetV3并基于迁移学习训练
Construction plan of Zhuhai food physical and chemical testing laboratory
Pbootcms plug-in automatically collects fake original free plug-ins
[groovy] XML serialization (use markupbuilder to generate XML data | set XML tag content | set XML tag attributes)
毕设-基于SSM高校学生社团管理系统
[Arduino syntax - structure]
NLP text processing: lemma [English] [put the deformation of various types of words into one form] [wet- > go; are- > be]
Dede collection plug-in free collection release push plug-in
After 95, the CV engineer posted the payroll and made up this. It's really fragrant
[groovy] JSON string deserialization (use jsonslurper to deserialize JSON strings | construct related classes according to the map set)
The growth path of test / development programmers, the problem of thinking about the overall situation
Promise
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
从 1.5 开始搭建一个微服务框架——调用链追踪 traceId
Convert binary search tree into cumulative tree (reverse middle order traversal)
测试/开发程序员的成长路线,全局思考问题的问题......
[groovy] compile time metaprogramming (compile time method interception | find the method to be intercepted in the myasttransformation visit method)
curlpost-php
Differences between standard library functions and operators