当前位置:网站首页>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 :
边栏推荐
- 第一章:求所有阶乘和数,大奖赛现场统分程序设计,三位阶乘和数,图形点扫描,递归求n的阶乘n!,求n的阶乘n!,舍罕王失算
- Day18 - basis of interface testing
- 2022 - 06 - 30 networker Advanced (XIV) Routing Policy Matching Tool [ACL, IP prefix list] and policy tool [Filter Policy]
- Summary of 90 day learning materials and notes of Zhang Fei's actual electronic hardware engineer
- 第一章:递归求n的阶乘n!
- Xctf attack and defense world crypto advanced area best_ rsa
- Ego planner code parsing Bspline_ Optimizer section (1)
- Flume learning notes
- Pecan — Overview
- Why should the gradient be manually cleared before back propagation in pytorch?
猜你喜欢

QT -- qfileinfo file information reading

第二章:求a,b的最大公约与最小公倍数经典求解,求a,b的最大公约与最小公倍数常规求解,求n个正整数的的最大公约与最小公倍数

Buuctf's different flags and simplerev

Chapter 1: find the factorial n of n!

PR FAQ: how to set PR vertical screen sequence?

FBI warning: some people use AI to disguise themselves as others for remote interview

BOC protected alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC supplied by Qiyu

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

kubernetes集群搭建efk日志收集平台

Ae/pr/fcpx super visual effects plug-in package fxfactory
随机推荐
Flume learning notes
BOC protected amino acid porphyrins TAPP ala BOC, TAPP Phe BOC, TAPP Trp BOC, Zn · TAPP ala BOC, Zn · TAPP Phe BOC, Zn · TAPP Trp BOC Qiyue
Analysis of dart JSON encoder and decoder
第一章:求奇因数代数和,求同吗小数和s(d, n),简化同码小数和s(d, n),拓广同码小数和s(d, n)
The most valuable thing
Day11 ---- 我的页面, 用户信息获取修改与频道接口
第二章:4位卡普雷卡数,搜索偶数位卡普雷卡数,搜索n位2段和平方数,m位不含0的巧妙平方数,指定数字组成没有重复数字的7位平方数,求指定区间内的勾股数组,求指定区间内的倒立勾股数组
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
Using the visualization results, click to appear the corresponding sentence
I study database at station B (4): DQL
Free sharing | linefriends hand account inner page | horizontal grid | not for sale
PR 2021 quick start tutorial, how to create a new sequence and set parameters?
[optics] vortex generation based on MATLAB [including Matlab source code 1927]
FBI warning: some people use AI to disguise themselves as others for remote interview
P1891 crazy LCM (Euler function)
Day10 ---- 强制登录, token刷新与jwt禁用
10 smart contract developer tools that miss and lose
第二章:求a,b的最大公约与最小公倍数经典求解,求a,b的最大公约与最小公倍数常规求解,求n个正整数的的最大公约与最小公倍数
2022-07-02 网工进阶(十五)路由策略-Route-Policy特性、策略路由(Policy-Based Routing)、MQC(模块化QoS命令行)
Chapter 1: sum of three factorials, graph point scanning