I faced this situation and solved it by using the CLI tool newmanįirst you need to export your collection and the environment as JSON files. Warning: you must reset the responseData value as after every use of Collection Runner in order to avoid keeping data from previous runs. Now you can retrieve a nested JSON object with all the response data included by viewing the environment variables value (see example below). Var old = pm.environment.get("responseData") Ĭonsole.log(pm.environment.get("responseData")) Postman environment variables are intended to be used as string, so we will parse the object then push the JSON responses from the API into the object array. Then, add the following code under 'Tests' in Builder & save your collection. JSON file in a text editor after Collection Runner completes.įirst you'll need to create an environment ( great tutorial in this blog post on Postman), and define a variable called responseData, with the value. Here is a simple workaround if you're OK with storing the final data in an Environment Variable & just copying it to a.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |