anthonyvscode / newman-action

A GitHub Action for running Newman CLI by Postman
MIT License
34 stars 11 forks source link

Newman CLI Postman Collection Runner

build-test

Newman is a command line Collection Runner for Postman. It allows you to run and test a Postman Collection directly from the command line, or in this case, from a github action.

Usage

Local collection file

- name: Checkout
  uses: actions/checkout@v1

- name: Run API Tests
  id: run-newman
  uses: anthonyvscode/newman-action@v1
  with:
    collection: collection.json
    reporters: cli

- name: Output summary to console
  run: echo ${{ steps.run-newman.outputs.summary }}

Hosted collection file

- name: Checkout
  uses: actions/checkout@v1

- name: Run API Tests
  id: run-newman
  uses: anthonyvscode/newman-action@v1
  with:
    collection: http://example.com/collection.json
    reporters: cli

- name: Output summary to console
  run: echo ${{ steps.run-newman.outputs.summary }}

Postman API

See Postman API for full functionality.


- name: Checkout
  uses: actions/checkout@v1

- name: Run API Tests
  id: run-newman
  uses: anthonyvscode/newman-action@v1
  with:
    apiKey: ${{ secrets.postmanApiKey }}
    collection: bab22df3-0221-0251-5849-b34eab2bfa49
    reporters: cli

- name: Output summary to console
  run: echo ${{ steps.run-newman.outputs.summary }}

Action Spec:

Environment variables

Inputs

This action is able to set all parameters listed in the Newman API Reference documentation

Outputs

Collection.Info.Name
Collection.Info.Id
Run.Stats.Requests.*
Run.Stats.Assertions.*
Run.Failures[n].Parent.Name
Run.Failures[n].Parent.Id
Run.Failures[n].Source.Name
Run.Failures[n].Error.Message
Run.Failures[n].Error.Test

https://giphy.com/gifs/seinfeld-door-get-out-DbSZni6xAW2Ws