Access Request values in Jmeter Post processors

Is there any function for accessing the Jmeter request values since my response after creation list all data in database i want to filter out with specific created value using JSON path extractor

Upvotes: 0

Views: 725

Answers (1)

Dmitri T
Dmitri T

Reputation: 168092

If you're using HTTP Request sampler to post some JSON and want to apply JSON Extractor to this data it can be done in 2 steps:

  1. Add JSR223 PostProcessor and use the following piece of code in order to save request data into request JMeter Variable:

    vars.put('request', sampler.getArguments().getArgument(0).getValue())
    

    where:

    • vars - shorthand for JMeterVariables
    • sampler - shorthand for the current Sampler in the JSR223 PreProcessor's scope

    see Top 8 JMeter Java Classes You Should Be Using with Groovy for more information and examples

  2. Once done you can use JSON Extractor and point it to the request JMeter Variable

    enter image description here

Demo:

enter image description here

Upvotes: 1

Related Questions