Skip to content

anthonyvscode/newman-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

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

  • None

Inputs

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

  • apiKey (required if collection_uuid is set) - Postman API key
  • collection (required) - Path to the JSON, URL or a collection_uuid to query on the postman hosted api
  • environment (optional) - Path to the JSON, URL or an environment_uuid to query on the postman hosted api
  • globals (optional) - Path to the JSON or URL where the global JSON is hosted
  • iterationCount (optional, default value: 1) - Number of iterations to run on the collection
  • iterationData (optional) - Path to the JSON or CSV file or URL to be used as data source when running multiple iterations on a collection.
  • folder (optional) - Name/ID of folders to run instead of entire collection
  • workingDir (optional, default value: .) - Path to be used as working directory
  • insecureFileRead (optional, default value: true) - Allow reading files outside of working directory
  • timeout (optional, default value: Infinity) - Time to wait for the collection run to complete
  • timeoutRequest (optional, default value: Infinity) - Time to wait for scripts to return a response
  • timeoutScript (optional, default value: Infinity) - Time to wait for scripts to return a response
  • delayRequest (optional, default value: 0) - Time to wait between subsequent requests
  • ignoreRedirects (optional) - Follow 3xx responses
  • insecure (optional) - Disable SSL verification and allow self-signed SSL
  • bail (optional) - Stop collection run gracefully on error
  • suppressExitCode (optional) - Always exit cleanly
  • reporters (optional) - Reporter to use
  • reporter (optional) - Reporter options
  • color (optional, default value: auto) - Modify colored CLI output
  • sslClientCert (optional) - Path to public client certificate
  • sslClientKey (optional) - Path to secret client key file
  • sslClientPassphrase (optional) - Secret client key passphrase

Outputs

  • summary_full (JSON object) - Full summary as returned from the run.
  • summary (JSON object) - condensed summary consisting of these summary items only:
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