Postman testing over API Key, created to bypass the limitations of Postman Collection Runner.
Ensure the following dependencies are added to your project:
To integrate this setup into your project, follow these steps:
-
Copy Postman Directory
Clone or download thepostman
folder from this repository and place it in the root of your project directory. -
Install Dependencies
Install the required dependencies using npm:npm install dotenv cross-env newman
-
Update npm Scripts
Add the following scripts to your project'spackage.json
file for easy execution:"scripts": { "pm:export": "node postman/pm_export_exec.js", "newman": "node postman/newman_exec.js" }
-
Configure Environment Variables
Update your.env
file with the following values:- Postman API Key: Get from
https://web.postman.co/settings/me/api-keys
- Postman Collection UID (dev & prod): Get from
https://api.getpostman.com/collections?apikey={YOUR_API_KEY}
- Postman Environment UID (dev & prod): Get from
https://api.getpostman.com/environments?apikey={YOUR_API_KEY}
Note:
- Prod UID is optional. Without
--prod
, dev UIDs are used. You can reuse the dev UID for both.
- Postman API Key: Get from
Use the npm scripts to run your tests with or without environment exports.
npm run newman -- --export
npm run newman -- --export --prod
npm run newman
npm run pm:export
npm run pm:export -- --prod
Feel free to contribute to this repository by submitting pull requests, creating issues, or offering suggestions for improvements.