This project have been created in order to demonstrate API tests automation using Postman collections and Newman as test runner. Besides that, it is possible to generate:
- Newman report;
- Allure report;
- Azure pipeline including schedulers triggers;
- Clone or download this project
- Import this project into VSCode or other IDE
After installing Node.js, install Newman using the command:
npm install -g newman
Go to project root and execute the following commands:
- To run viacep api tests:
newman run apiTests/viacep/viacep.postman_collection.json -e apiTests/viacep/viacep.postman_env.json -r cli
- To run zipcode api tests:
newman run apiTests/zipcode/zipcode.postman_collection.json -e apiTests/zipcode/zipcode.postman_env.json -r cli
The argument (-r cli) at the end is to print the test results in the terminal.
Install Newman report:
npm i -g newman-reporter-htmlextra
Execute the tests passing the argument (-r htmlextra) at the end of the run command, as below:
newman run apiTests/viacep/viacep.postman_collection.json -e apiTests/viacep/viacep.postman_env.json -r htmlextra
A folder named newman containing the html report will be generated in the project root.
Install Allure report:
npm i -g newman-reporter-allure
Execute the tests passing the argument (-r allure) at the end of the run command, as below:
newman run apiTests/viacep/viacep.postman_collection.json -e apiTests/viacep/viacep.postman_env.json -r allure
A folder named allure-results containing some files will be generated in the project root. On project root, run allure-commandline to open the report:
allure serve allure-results
A local server will be started and the reporter will be opened in your browser.
You can use the azure-pipelines.yml localized under .pipelines folder as example to create an Azure pipeline.