{"id":20420229,"url":"https://github.com/ghoshasish99/postman-newman","last_synced_at":"2026-05-21T16:37:47.755Z","repository":{"id":118153308,"uuid":"342088725","full_name":"ghoshasish99/Postman-Newman","owner":"ghoshasish99","description":"API testing with Postman","archived":false,"fork":false,"pushed_at":"2021-02-25T17:31:08.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-15T14:35:20.440Z","etag":null,"topics":["apitesting","newman","newman-reporter","postman","postman-collection","postman-test"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghoshasish99.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-25T01:41:19.000Z","updated_at":"2021-07-02T07:39:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"1cedf105-9843-4e53-9565-928adfa3fe16","html_url":"https://github.com/ghoshasish99/Postman-Newman","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghoshasish99%2FPostman-Newman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghoshasish99%2FPostman-Newman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghoshasish99%2FPostman-Newman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghoshasish99%2FPostman-Newman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghoshasish99","download_url":"https://codeload.github.com/ghoshasish99/Postman-Newman/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241963410,"owners_count":20049840,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apitesting","newman","newman-reporter","postman","postman-collection","postman-test"],"created_at":"2024-11-15T06:42:06.410Z","updated_at":"2025-12-03T16:01:35.366Z","avatar_url":"https://github.com/ghoshasish99.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# API testing with Postman and Newman\n \n[![Build Status](https://dev.azure.com/AutomationsTools/Execution/_apis/build/status/Postman-Newman?branchName=main)](https://dev.azure.com/AutomationsTools/Execution/_build/latest?definitionId=8\u0026branchName=main)\n\n* *Postman* is a lightweight API testing solution. Its predominantly used for Testing but can be used for API developments too. \n* *Newman* is the commandline collection runner for Postman which facilitates execution via CICD\n\nPostman supports REST, SOAP, or plain HTTP. One can download Postman from here : https://www.postman.com/downloads/\n\nIn Postman, one can create individual requests and add them to a *Collection*. Inorder to run a *Collection* from commandline, we need **Newman**.\n\n### To download and install Newman , run this command on the terminal :\n```shell\nnpm install -g newman\n```\nThis will install newman globally.\n\n### Some basic Newman commands are :\n\nOperations | Commands\n---- | ----\nSimple collection run | `newman run MyCollection.json`\nRun a collection with environment details | `newman run MyCollection.json -e Env.json`\nRun a collection with an external data source | `newman run MyCollection.json -d UserData.csv`\nGenerate Junit report | `newman run MyCollection.json --reporters junit --reporter-junit-export junit.xml`\n\n### Chaining API requests :\n\nSometimes we may require to fire a chain of APIs passing data from one API response to another API request. Lets take the following example :\n- Create a user\n- Extract the User ID from the response\n- Use the User ID to Delete the user\n\nHere we will use the `Tests` section of a Request in Postman.\n\nIf the response of the Create User is :\n```json\n{\n    \"first_name\": \"Ashish\",\n    \"last_name\": \"Ghosh\",\n    \"email\": \"Ashish.Ghosh@jsonserver.com\",\n    \"id\": 3\n}\n```\nTo extract the `id` value and store it in a variable `UserID` defined in Postman, in the Test section add this :\n\n```javascript\nvar jsonData = JSON.parse(responseBody);\npostman.setEnvironmentVariable(\"UserID\", jsonData.id);\n``` \nNow this `UserID` variable can be used in the next Postman request.\n\nFor XML responses, the approach will be similar, but syntax will be different :\n\nIf the XML response is :\n```xml\n\u003c?xml version='1.0' encoding='utf-8'?\u003e\n\u003csoapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\u003e\n    \u003csoapenv:Body\u003e\n        \u003csoapenv:Result\u003e\n             \u003cCreateUser success=\"true\"\u003e\n                \u003cuser version=\"1.0\" alias=\"800006698200\" status=\"Created\" id=\"3\"/\u003e\n            \u003c/CreateUser\u003e\n        \u003c/soapenv:Result\u003e\n    \u003c/soapenv:Body\u003e\n\u003c/soapenv:Envelope\u003e\n```\nTo extract the `id` value and store it in a variable `UserID` defined in Postman, in the Test section add this :\n\n```javascript\nvar jsonObject = xml2Json(responseBody);\nvar user_id = jsonObject['soapenv:Envelope']['soapenv:Body']['soapenv:Result']['CreateUser']['user'].$.id;\npm.environment.set (\"UserID\", user_id);\n``` \nTo view a document generated by Postman click here : https://documenter.getpostman.com/view/5085233/TWDcEDxP\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghoshasish99%2Fpostman-newman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghoshasish99%2Fpostman-newman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghoshasish99%2Fpostman-newman/lists"}