2

I am using two JSR223 preprocessors,in which I want to use variable from one preprocessor into another preprocessor.

how can I use this in Jmeter??

Please assist me with an example.

1 Answer 1

4
  1. In the first PreProcessor store some value into a foo JMeter Variable using vars shorthand for JMeterVariables class instance like:

    vars.put('foo', 'some value')
    
  2. In the second PreProcessor you can read the value using the same vars shorthand like:

    String myString = vars.get('foo') 
    

See Top 8 JMeter Java Classes You Should Be Using with Groovy article for more information on this vars shorthand and other JMeter API shortcuts available for the JSR223 Test Elements

The variable can be seen using Debug Sampler and View Results Tree listener combination.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks..In the same case if I want to extract response variable from a JSON response and pass the same in next Preprocessor,what should I use??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.