![]() The whole reason why I'm not using the Official Image is to get a custom HTML report from the collection run - For this I'm using the newman-html-reporter module, in order to tell newman to use this I've added a couple of arguments to the command property in the docker-compose.yml file. ![]() The default output if you're using newman locally or using the Docker Image, is on the CLI - This will give you a simple breakdown of what happened during the collection run. src dir to the /etc/newman dir in the containerĬollection Run Output On The Command Line volumes - This is equally import as it provides a link from the local.command - This is the important part, it's the command that tells newman where your files are located and what output you would like after the collection run.image - Same reason for using a container_name, this just gives the image a name.build - This is building from the root dir as this is where my Dockerfile is located.container_name - Gives the new container a friendly name or it will pick up the default random name.This file contains a few default properties version and services, these are required to make it a valid docker-compose file, I've also then added a service name of postman_checks.Īs well as these standard file properties, I have some additional ones that are specific to my collection run: Run Restful_Booker_Collection.json -e environments/Restful_Booker_Environment.json -r html,cli -reporter-html-export reports/Restful_Booker_Test_Run.html -reporter-html-template reports/templates/customTemplate.hbs volumes: This file also creates a new WORKDIR and specifies an ENTRYPOINT.Ĭontainer_name: restful_booker_checks build. My current Dockerfile looks like this, I needed nodejs so I have used a version (I could just take the latest but I haven't for now) of the node base Image and then installed the two modules 'globally' via npm. Ooh Fancy.īy wanting to do this, I needed to create my own Dockerfile, the postman/newman_alpine33 base Image nodejs and newman versions are getting a bit old now and the latest version of the newman-reporter-html module requires newman >= v4.0.0 and nodejs >= v6.x - Both of which are not part of the official Image. I could have used the postman/newman_alpine33 Image and that would have run my collection fine but I wanted to extend this out slightly and add a custom HTML report which gets created following the collection run. This example is used to show you the collection running using the Docker Image and what the output is in the terminal. This command will run a basic collection that sends a few requests to httpbin and performs some checks. This is an example taken from Dockerhub using the postman/newman_alpine33 image:ĭocker run -t postman/newman_alpine33 run It's really simple to get your Postman collections running with the image, straight from the command line. Postman has it's own official Docker Image on Dockerhub with instructions to get you set up and started. I've created an example based repository for anyone to get an idea of how to start using your Postman Collections, created in the within the application and run these using a Docker Image. Docker is by no means a new technology but it is newish to me so I'm kind of 'learning by doing' and creating something that works but can be updated once my own Docker knowledge increases, you have to start somewhere :). This is where using Docker comes in handy, you can use pre-defined Images that contain everything you need to run the checks, without the need to install lots of different dependencies onto your local machines. I have nodejs installed on my local machine so it's easy for me to globally install newman and crack on with running the checks but some folks won't have this and probably don't want to install nodejs on their machine. Postman is awesome, building and running your checks through the built-in collection runner is amazing but what I like to do, once I have a stable set of requests, is to export my Collection and Environment files from the application and run them in the command line using Newman.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |