当前位置:网站首页>Acquisition and transmission of parameters in automatic testing of JMeter interface
Acquisition and transmission of parameters in automatic testing of JMeter interface
2022-07-03 19:32:00 【Xiaoqiang ~】
jmeter Interface automation testing : Parameter acquisition and transmission
I've learned before java Code , So forget is not important to Baidu , Hit a few lines of code to achieve some simple data processing
stay jmeter Select from the post processor of the request beanshell processor , It's easy to write some simple code .
But for the jar The call of the package encountered some trouble : hold jar The bag is in lib In file , restart jmeter, stay beanshell in , Use jsonArray.getJSONObject() There is no such method for error reporting
After various searches , In the test plan Add the following jar Package path , And put jar bag lib/ext Under the table of contents

next : stay beanshell Editor import Introduce the jar package

stay beanshell Editor import Introduce the jar package
After executing the request , For the acquisition of response data :
String a = prev.getResponseDataAsString(); return String character string
Turn it into json Format :
JSONObject json = JSONObject.parseObject(a)
Get the value corresponding to the key in the object :json.get(" Key name "); json.get(" Key name ").get(" Key name ");
Turn it into array The array format :
JSONArray arr = JSONArray.parseArray(a);
adopt JSONObject json = JSONjson.getJSONObject( Subscript value ) To get the corresponding subscript object .
Add objects to array In the array :arr.add(json);
String arr6 = arr.toString();
jmeter Assign values to custom variables in : The assigned value must be of string type
vars.put("arr6",arr6 );Convert objects to strings :String.valueOf(jsonData.get("data").get("data"));
The above customized variables arr6, It is used as a request parameter in other interface requests :
For example

The first 2 Kind of : Add json Extractor :
边栏推荐
- Sentinel source code analysis part II - sentinel dashboard console startup and configuration
- Thinking about festivals
- Strict data sheet of new features of SQLite 3.37.0
- kubernetes集群搭建efk日志收集平台
- Buuctf's different flags and simplerev
- Basic principle of LSM tree
- Bad mentality leads to different results
- [leetcode] [SQL] notes
- Ego planner code parsing Bspline_ Optimizer section (3)
- BOC protected alanine porphyrin compound TAPP ala BOC BOC BOC protected phenylalanine porphyrin compound TAPP Phe BOC Qi Yue supply
猜你喜欢

Chapter 1: extend the same code decimal sum s (D, n)

BOC protected phenylalanine zinc porphyrin (Zn · TAPP Phe BOC) / iron porphyrin (Fe · TAPP Phe BOC) / nickel porphyrin (Ni · TAPP Phe BOC) / manganese porphyrin (Mn · TAPP Phe BOC) Qiyue Keke
![[optics] vortex generation based on MATLAB [including Matlab source code 1927]](/img/9b/b7f462e2ecbff0cee35e7de5c80cf7.jpg)
[optics] vortex generation based on MATLAB [including Matlab source code 1927]

PR 2021 quick start tutorial, material import and management

2022-06-27 网工进阶(十二)IS-IS-开销类型、开销计算、LSP的处理机制、路由撤销、路由渗透

第一章:递归求n的阶乘n!

CMD implements the language conversion of locale non Unicode programs

Why should we do feature normalization / standardization?

第一章:求同吗小数和s(d, n)

第一章:求n的阶乘n!
随机推荐
Ego planner code parsing Bspline_ Optimizer section (3)
2022-07-02 网工进阶(十五)路由策略-Route-Policy特性、策略路由(Policy-Based Routing)、MQC(模块化QoS命令行)
01 - QT OpenGL display OpenGL window
Go home early today
During MySQL installation, the download interface is empty, and the components to be downloaded are not displayed. MySQL installer 8.0.28.0 download interface is empty solution
Zhang Fei hardware 90 day learning notes - personal record on day 6. Please see my personal profile / homepage for the complete record
Native table - scroll - merge function
These problems should be paid attention to in the production of enterprise promotional videos
2022-06-25 网工进阶(十一)IS-IS-三大表(邻居表、路由表、链路状态数据库表)、LSP、CSNP、PSNP、LSP的同步过程
UE source code analysis: uccharactermovementcomponent - rootmotion
Pecan — Overview
Summary of composition materials for 2020 high-frequency examination center of educational resources
Summary of learning materials and notes of Zhang Fei's actual combat electronics 1-31
How to build an efficient information warehouse
原生表格-滚动-合并功能
第一章:简化同码小数和s(d, n)
[proteus simulation] a simple encrypted electronic password lock designed with 24C04 and 1602LCD
2022-06-30 网工进阶(十四)路由策略-匹配工具【ACL、IP-Prefix List】、策略工具【Filter-Policy】
第一章:求n的阶乘n!
FBI warning: some people use AI to disguise themselves as others for remote interview