QA Prof
QA Prof

Reputation: 63

how to run docker for newman with environment and global json

Tried adding docker for newman with below commands:

  1. Pulling the image:docker pull postman/newman_ubuntu1404
  2. sudo docker run -it --name newman postman/newman_ubuntu1404 newman run tests.json --environment ~/environments/staging.json -n 1 --globals ~/data/globals.json 
    

    and it throw error

    Newman: Invalid command or parameter.
    

Example:

newman run my-api.json -e variables.json

Tried adding -v mount volume with docker but it doesnot work.

So how do I pass the tests, environment and globals JSON in docker.

Upvotes: 2

Views: 2563

Answers (2)

CodeFarmer
CodeFarmer

Reputation: 2708

I did some modification:

docker run \
--rm \
-it \
# Mount local directory
-v `pwd`/test_folder:/etc/postman \
brandondoran/docker-newman -e test_folder/production.json collection.json

Reference: https://github.com/brandondoran/docker-newman

Upvotes: 0

Thomas Sablik
Thomas Sablik

Reputation: 16447

You have to run the docker image with arguments only (without newman). The files are mounted into /etc/newman. Try

docker run --rm --name newman --volume ~:/etc/newman postman/newman_ubuntu1404 run tests.json --environment environments/staging.json -n 1 --globals data/globals.json

Upvotes: 2

Related Questions