Search code examples
groovyjmeterjmeter-5.0

Extract value from jsr223 sampler


enter image description here

enter image description here

How to extract maxValue_max from jsr223 sampler to the next request? I see that the sampler determines the maximum value, how now to extract and use it?


Solution

  • You do have the value written into a JMeter Variable already, you can just call ${maxValue_max} where required and the variable will be resolved to its respective value.

    Or if you prefer Groovy scripting you can use __groovy() function like:

    enter image description here

    You might also want to call 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.

    Check out Top 8 JMeter Java Classes You Should Be Using with Groovy for more information on this SampleResult and other JMeter API shorthands available for the JSR223 Test Elements