当前位置:网站首页>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 :
边栏推荐
- 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
- Thinking about festivals
- Pecan — Overview
- Day11 ---- 我的页面, 用户信息获取修改与频道接口
- PR 2021 quick start tutorial, how to create a new sequence and set parameters?
- 2020 intermediate financial management (escort class)
- FBI警告:有人利用AI换脸冒充他人身份进行远程面试
- Zhang Fei hardware 90 day learning notes - personal records on day 2, please see my personal profile / homepage for the complete
- CMD implements the language conversion of locale non Unicode programs
- Xctf attack and defense world crypto advanced area best_ rsa
猜你喜欢

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

第一章:求所有阶乘和数,大奖赛现场统分程序设计,三位阶乘和数,图形点扫描,递归求n的阶乘n!,求n的阶乘n!,舍罕王失算

第一章:求奇因数代数和,求同吗小数和s(d, n),简化同码小数和s(d, n),拓广同码小数和s(d, n)

Chapter 1: find the factorial n of n!
![[leetcode] [SQL] notes](/img/8d/160a03b9176b8ccd8d52f59d4bb47f.png)
[leetcode] [SQL] notes

NFT without IPFs and completely on the chain?

第一章:拓广同码小数和s(d, n)

Php based campus lost and found platform (automatic matching push)

These problems should be paid attention to in the production of enterprise promotional videos

第二章:求a,b的最大公约与最小公倍数经典求解,求a,b的最大公约与最小公倍数常规求解,求n个正整数的的最大公约与最小公倍数
随机推荐
Thesis study - 7 Very Deep Convolutional Networks for Large-Scale Image Recognition (3/3)
第一章:求奇因数代数和,求同吗小数和s(d, n),简化同码小数和s(d, n),拓广同码小数和s(d, n)
UE source code analysis: uccharactermovementcomponent - rootmotion
Day18 - basis of interface testing
EGO Planner代码解析bspline_optimizer部分(3)
01. Preparation for automated office (free guidance, only three steps)
P1891 crazy LCM (Euler function)
BOC protected tryptophan zinc porphyrin (Zn · TAPP Trp BOC) / copper porphyrin (Cu · TAPP Trp BOC) / cobalt porphyrin (cobalt · TAPP Trp BOC) / iron porphyrin (Fe · TAPP Trp BOC) / Qiyue supply
Flume learning notes
Chapter 20: y= sin (x) /x, rambling coordinate system calculation, y= sin (x) /x with profile graphics, Olympic rings, ball rolling and bouncing, water display, rectangular optimization cutting, R que
unittest框架基本使用
Sentinel source code analysis part I sentinel overview
Go home early today
论文阅读 GloDyNE Global Topology Preserving Dynamic Network Embedding
Xctf attack and defense world crypto master advanced area olddriver
Chapter 1: simplify the same code decimal sum s (D, n)
Day11 ---- 我的页面, 用户信息获取修改与频道接口
Zhang Fei hardware 90 day learning notes - personal records on day 2, please see my personal profile / homepage for the complete
Latex image rotates with title
CesiumJS 2022^ 源码解读[7] - 3DTiles 的请求、加载处理流程解析