在 JMeter 中,当我尝试将分配给 JSON 提取器的变量传递给后续请求时,空值被传递

In JMeter when I try to pass the variable assigned with JSON extractor to the subsequent request null value is passed

我使用 Jmeter 发出 POST 请求,并使用 JSON 提取器解析 JSON 响应。当我使用调试采样器时,我可以看到变量被正确分配了值,但该值在后续请求中变为 null

下面是下一个样本的请求URL/XXX/XXX/XXX/XX/${recordingjobid} 但此值 recordingjobid 未替换为该值。

我只能想到 JSON 提取器的位置不正确。

例如,如果您将它与多个采样器放在同一级别 - 它将在每个采样器之后 运行(包括 Debug Sampler) and each next one will be overwriting the value set by the previous one as JMeter Variables 是线程本地的并且不允许重复.

所以我的期望是,如果您将 JSON 提取器移动为 returns JSON 请求的子级 - 它应该可以解决您的问题。

更多信息:JMeter Scoping Rules - The Ultimate Guide