postmanlabs/newman-docker

Name: newman-docker

Owner: Postman

Description: Docker images for Newman Collection Runner

Created: 2015-07-21 12:02:58.0

Updated: 2018-05-18 15:42:21.0

Pushed: 2018-03-12 07:55:19.0

Homepage: null

Size: 133

Language: Shell

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Deprecation notice:

This repository is now deprecated and will soon be archived.
The Newman Docker images are now a part of https://github.com/postmanlabs/newman. For more context, see https://github.com/postmanlabs/newman/pull/1397.
All issues, questions, feature requests or discussions about the Newman Docker image(s) should be shifted to https://github.com/postmanlabs/newman/issues

newman-docker

This repository contains docker images for Newman.

Newman is a command-line collection runner for Postman. It allows you to effortlessly run and test a Postman Collections directly from the command-line. It is built with extensibility in mind so that you can easily integrate it with your continuous integration servers and build systems.

New to Docker? Docker allows you to package an application with all of its dependencies into a standardised unit for software development. Visit https://www.docker.com/whatisdocker to read more about how docker can drastically simplify development and deployment.

Using the docker image

The docker image for Newman is available for download from our docker hub. You must have Docker installed in your system. Docker has extensive installation guideline for popular operating systems. Choose your operating system and follow the instructions.

Ensure you that you have docker installed and running in your system before proceeding with next steps. A quick test to see if docker is installed correctly is to execute the command docker run hello-world and it should run without errors.

Step 1:

Pull the newman docker image from docker hub:

er pull postman/newman_ubuntu1404

Step 2:

Run newman commands on the image:

er run -t postman/newman_ubuntu1404 run "https://www.getpostman.com/collections/8a0c9bc08f062d12dcda"
Build the docker image from this repository

Step 1:

Clone this repository:

clone https://github.com/postmanlabs/newman-docker.git

Step 2:

Build the image:

er build -t postman/newman_ubuntu1404 ubuntu1404

Step 3:

Run a collection using the newman image:

er run -t postman/newman_ubuntu1404 run "https://www.getpostman.com/collections/8a0c9bc08f062d12dcda"
Running local collection files

This docker image is designed to pick files from the /etc/newman directory within the image. You may mount the directory of your collection files into that location and provide the file references in standard newman parameters.

unt host collections folder ~/collections, onto /etc/newman on the docker image, so that newman
s access to collections
er run -v ~/collections:/etc/newman -t postman/newman_ubuntu1404 run "HTTPBinNewmanTestNoEnv.json.postman_collection"

You are not required to mount a volume if you do not need to save newman report to the host, and your collection is available online, unless your collection requires an environment(as environments cannot be passed as URLs).

To know more about mounting volumes, visit docker documentation on shared data volumes.

Examples

Run a local collection, pass an environment to it, and save the HTML report on the host.

er run -v ~/collections:/etc/newman -t postman/newman_ubuntu1404 \
run "HTTPBinNewmanTest.json.postman_collection" \
--environment="HTTPBinNewmanTestEnv.json.postman_environment" \
--reporters="html,cli" --reporter-html-export="newman-results.html"


Run a remote collection, pass it a local environment, and save JUnit XML test report on the host

er run -v ~/collections:/etc/newman -t postman/newman_ubuntu1404 \
run "https://www.getpostman.com/collections/8a0c9bc08f062d12dcda" \
--environment="HTTPBinNewmanTestEnv.json.postman_environment" \
--reporters="junit,cli" --reporter-junit-export="newman-report.xml"


Use a script to run a collection and do something, for example deploy the build, if all the tests pass

n/bash

op on first error
-e;

tion onExit {
if [ "$?" != "0" ]; then
    echo "Tests failed";
    # build failed, don't deploy
    exit 1;
else
    echo "Tests passed";
    # deploy build
fi


ll onExit when the script exits
 onExit EXIT;

er run -t postman/newman_ubuntu1404 run "https://www.getpostman.com/collections/8a0c9bc08f062d12dcda" --suppress-exit-code;

Analytics


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.