从 jsr223 采样器中提取值

Extract value from jsr223 sampler

enter image description here

enter image description here

如何从jsr223采样器中提取maxValue_max到下一个请求? 我看到采样器确定了最大值,现在如何提取和使用它?

您确实已经将值写入 JMeter Variable,您只需在需要的地方调用 ${maxValue_max},变量就会被解析为其各自的值。

或者,如果您更喜欢 Groovy 脚本,您可以使用 __groovy() function 例如:

您可能还想致电 SampleResult.setIgnore() function somewhere in your script so the JSR223 Sampler won't appear in the test results or just switch to JSR223 Post-Processor

查看 Top 8 JMeter Java Classes You Should Be Using with Groovy for more information on this SampleResult and other JMeter API 可用于 JSR223 测试元素的速记

您不需要提取,它是 JMeter 变量的一部分,您可以在 Debug Sampler 响应中看到

您可以将其用作 ${maxValue_max} 预期在 JSR223 脚本中,您应该在其中使用 vars.get("maxValue_max") 语法

how to reference a variable

Referencing a variable in a test element is done by bracketing the variable name with '${' and '}'.