0
votes

How to send multiple json request body with single api with mutiple parameters

Hi,

I want to hit an api with single user, mutiple json body(500) request should execute single time using parameterization and should save it in database as a single record.

1

1 Answers

0
votes

If you're looking for a way to build single large HTTP Request out of 500 JSON files you need to use JSR223 PreProcessor and concatenate 500 files into a single request body.

  1. Add JSR223 PreProcessor as a child of the request which payload you want to parameterize
  2. Use JsonSlurper to read files from the filesystem and JsonBuilder for generating the output JSON
  3. Use vars shorthand to store the value into a JMeter Variable like:

    vars.put('payload', jsonBuilder.toPrettyString())
    
  4. Use ${payload} in the HTTP Request sampler body data tab.

More information: