当前位置:网站首页>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 :
边栏推荐
- I didn't cancel
- Chapter 1: simplify the same code decimal sum s (D, n)
- 第一章:求所有阶乘和数,大奖赛现场统分程序设计,三位阶乘和数,图形点扫描,递归求n的阶乘n!,求n的阶乘n!,舍罕王失算
- Zhang Fei hardware 90 day learning notes - personal record on day 6. Please see my personal profile / homepage for the complete record
- 04 -- QT OpenGL two sets of shaders draw two triangles
- Random numbers in a long range, is that right- Random number in long range, is this the way?
- 01. Preparation for automated office (free guidance, only three steps)
- 第一章:拓广同码小数和s(d, n)
- 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
- P3402 persistent and searchable
猜你喜欢
[water quality prediction] water quality prediction based on MATLAB Fuzzy Neural Network [including Matlab source code 1923]
The necessity of lean production and management in sheet metal industry
CMD implements the language conversion of locale non Unicode programs
CesiumJS 2022^ 源码解读[7] - 3DTiles 的请求、加载处理流程解析
Day18 - basis of interface testing
第二章:求长方体数组,指定区间内的完全数,改进指定区间内的完全数
Flume learning notes
[optics] vortex generation based on MATLAB [including Matlab source code 1927]
IPv6 experiment
FBI warning: some people use AI to disguise themselves as others for remote interview
随机推荐
EGO Planner代碼解析bspline_optimizer部分(1)
Common text labels
Leetcode 1189. Maximum number of balloons (special character count)
Day_ 18 IO stream system
第二章:4位卡普雷卡数,搜索偶数位卡普雷卡数,搜索n位2段和平方数,m位不含0的巧妙平方数,指定数字组成没有重复数字的7位平方数,求指定区间内的勾股数组,求指定区间内的倒立勾股数组
Chapter 1: extend the same code decimal sum s (D, n)
Free year-end report summary template Welfare Collection
Sentinel source code analysis part I sentinel overview
03 -- QT OpenGL EBO draw triangle
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
Floating source code comment (38) parallel job processor
Chapitre 1: le roi de shehan a mal calculé
Summary of learning materials and notes of Zhang Fei's actual combat electronics 1-31
Unittest framework is basically used
The way to treat feelings
第二章:求长方体数组,指定区间内的完全数,改进指定区间内的完全数
Analyse du Code du planificateur ego bspline Section Optimizer (1)
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
Merge K ascending linked lists
Web Security (VII) specific process of authentication with session cookie scheme