0

I have set up a collection that executes an API request which its payload is a JSON file.

I would like to run this postman collection for several times using different values for a variable that I have set in my request. However, I don't know how to save the API response from my Get request into a JSON file.

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
PGZ_89
  • 1
  • 1
  • 2

1 Answers1

0

I have done the similar procedure as well for the automation test. Here were some steps I took:

  1. Write a script to execute the postman collection test through postman command line interface modules (https://github.com/postmanlabs/newman), where you can store all the command into a string array with different environment variables you want to specify.

    [new man collection -e env_var.json --reporters cli,json --reporter-json-export output.json, new man second run, ... ]

  2. For each execution, you can get the response body by nodejs module and dump the result to json format. (similar to: output responseBody somewhere with newman script from postman collection)

  3. Or you can generate the JSON from newman reporter, and parse the JSON to get the informantion you want.

Hope it helps!

Christie Chen
  • 185
  • 1
  • 5
  • 15