JMeter JSON 路径提取器

JMeter JSON Path extractor

我使用 JMeter 4,我在 JMeter JSON 路径提取器中遇到问题。 我对我不想测试的服务发出了 HTTP 请求 (POST)。

来自服务的响应数据是

{"rid":"661ff2d7-12e8-e811-8110-00215a9b9851",
 "participation":{"rid":"ed8cfced-0063-4fda-92fd-b23f50197797"}}

我不想提取第一个 GUID 分配给第一个 rid。

As JSONPath Expression 我使用了 $.rid 并且不想将该值分配给 JMeter 变量。因此我检查了单选按钮 JMeter 变量并输入了我的 JMeter 变量 int_rid.

当我执行 JMeter 测试计划时,int_rid 变量将为空。

JSON Extractor中,如果您选中单选按钮 JMeter 变量,它希望在 JMeter 变量的内容中搜索您不需要的内容,通常仅 Main 示例就足够了

Main sample only - only applies to the main sample

Sub-samples only - only applies to the sub-samples

Main sample and sub-samples - applies to both.

JMeter Variable Name to use - assertion is to be applied to the contents of the named variable

int_rid 放入 Names of created variables 字段并选择匹配编号 1 以查找第一个值