Skip to content

This is a project to demonstrate API automation using Postman and Newman. It also contains templates to Azure pipelines and instructions to generate local reports.

Notifications You must be signed in to change notification settings

grazielegrc/postman-newman-api-automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

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;

Pre-requisites

How to run locally

Setup

  • Clone or download this project
  • Import this project into VSCode or other IDE

Installation

After installing Node.js, install Newman using the command:

npm install -g newman

Run tests

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.

To generate Newman report

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.

To generate Allure report

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.

Pipeline

You can use the azure-pipelines.yml localized under .pipelines folder as example to create an Azure pipeline.

About

This is a project to demonstrate API automation using Postman and Newman. It also contains templates to Azure pipelines and instructions to generate local reports.

Topics

Resources

Stars

Watchers

Forks