当前位置:网站首页>jmeter里面的json提取器和调试器的用法
jmeter里面的json提取器和调试器的用法
2022-06-21 05:07:00 【xiao-qian】
1.JSON提取器的作用?
作用域是一个线程组内,使用于传递性的参数。(前面一个接口的响应里面的某个字段是后面接口里面入参的某个字段,这个时候就要再前面的接口加上josn提取器)
2.JSON提取器添加路径:在http请求-添加-后置处理器-JSON提取器。

3.json提取器的学习如下:

1)那么JSON取值应该如何取到了?
先看如下一段实例:
{
"total": "1",
"current": "1",
"size": "10",
"records": [
{
"objectVersionNumber": null,
"shipper": "TCLKING",
"extFiled3": null,
"fromFactory": "1000",
"ifMatMaterialSystem": "SAP",
"waveNo": null,
"lastUpdateDate": "2022-06-14 04:04:02",
"extFiled2": null,
"modifier": "超级管理员",
"extFiled1": null,
"toAddress": null,
"branch": null,
"productName": null,
"productLine": "11",
"carrierName": null,
"planRetrievalDate": "2022-06-05 00:00:00",
"retrievalNo": "OUT113120220605001633",
"purchaseNo": null,
"id": "1533275854937051137",
"state": 5,
"lastUpdatedBy": "1",
"returnNo": null,
"costCenter": null,
"creationDate": "2022-06-05 10:33:45",
"priority": null,
"workCenter": null,
"customerName": null,
"saleNo": null,
"closeFlag": "O",
"productLineName": null,
"detailList": [
],
"isOverShip": 1,
"purchaseItem": null,
"actualRetrievalDate": null,
"externalType": "BD01",
"customerKey": null,
"externalNo": "11317142",
"toFactory": null,
"productionState": 0,
"remark": null,
"warehouseCode": null,
"toWarehose": null,
"loadNo": null,
"bu": "0",
"productOrderNo": "11317142",
"carrierKey": null,
"fromAddress": null,
"productBatch": null,
"twhere": null,
"planEndDate": "2022-06-09 00:00:00",
"creator": "超级管理员",
"retrievalType": "SCGD",
"product": "Z1U50102000015",
"retrievalDate": "2022-06-05 00:00:00",
"deliveryNo": null,
"moveType": null,
"reservedNo": "0054591598",
"retrievalGroup": null,
"site": null,
"createdBy": "1",
"processCode": null,
"ifMatRetrievalId": "1533275307894697985",
"updateResource": null
}
]
}2)json取值语法:
1$代表json取值
.代表下一级
要取哪个值(如果要取10)就用他的键去取如,size
[]代表列表,[*]匹配里面所有的元素,[0]代表取第一个元素,[1]代表取第二个元素以此类推。
那么场景来了,若我们要取size的值应该这样写:$.size,若要取objectVersionNumber这样写:$.records[0].objectVersionNumber
可以按照语法写,若担心写的对不对,可以直接在响应报文那里,格式更换成JSON Path Expression,然后点击test进行调试如下:

学以致用的话,若取多个参数就如下:变量名之间用;隔开,json取值也用;隔开,匹配也是用;隔开,否则值之间也是用;隔开,每行保持一致性,不能说变量有五个,josn取值就只写了4个,或者匹配写6个,还有一定要用英文的分割符号,如下就是两个变量的场景。

4. 怎么看自己的变量值是否取到了,可以在josn取值后面加一个调试器路径如下:

调试器的英文名对应的就是Debug PostProcessor,运行后可以在查看变量取值:

边栏推荐
- Distance measurement - standardized Euclidean distance
- 高通LCD bring up流程
- Physical principle of space design in maker Education
- Z 字变形[规律的形式之一 -> 周期考察]
- Technology sharing | software project management and cross departmental communication and collaboration
- 怎么样学习pmp知识?
- 性能优化----内存分析
- Launcher page cut Animation
- [development of API interface based on oauth2] 3. User defined authorization method
- 适配器模式Adapter
猜你喜欢

基于SSM+Hui+MySQL的高校大学生信息管理系统

Abbexa HSD11B2 antibody solution

How to take anti extortion virus measures for enterprise servers

Community app based on arkui of harmonyos (II) -- login interface

Jatpack之 LifeCycle

Share an open source, free and powerful video player library

Abbexa GM130 抗体解决方案

ESP32 SSL/TLS 双向认证实践

Super classic MySQL common functions, collect them quickly

迎接创客教育+互联网的黄金时代
随机推荐
The golang regular regexp package uses -03- to find matching strings, find matching string positions, and regular grouping (findsubmatch series methods, findsubmatchindex series methods)
基于SSM+Bootstrap+MySQL+Thymeleaf的汽车维修管理系统
Physical principle of space design in maker Education
golang正则regexp包使用-03-查找匹配字串,查找匹配字串位置,正则分组(FindSubMatch系列方法,FindSubmatchIndex系列方法)
根据类中某个属性去重
登录认证(一) —— 几种登录方式简介
dayjs获取当月第一天最后一天 当年第一天最后一天
高通骁龙处理器DSP
PMP和MBA哪个含金量高一点?
迎接创客教育+互联网的黄金时代
距离度量 —— 标准化欧氏距离 (Standardized EuclideanDistance)
项目管理PMP多大作用?
常见的请求方式和请求头参数
How to learn PMP knowledge?
MyBaits-plus
Project initiation and requirement review of software testing
Reflective
怎么样学习pmp知识?
Relationship between CLK clock frequency of Mipi LCD and display resolution and frame rate
83. (cesium chapter) how to run the cesium example