Skip to main content

Posts

Showing posts with the label newman

Postman CLI Vs Newman

The Postman v10 release in Q3 of 2022 introduced the Postman CLI. If you are interested to know whether you should move from Newman to Postman CLI, please go through this: https://learning.postman.com/docs/postman-cli/postman-cli-overview Here is a direct comparison table: Postman CLI Vs Newman: https://learning.postman.com/docs/postman-cli/postman-cli-overview/#comparing-the-postman-cli-and-newman This should help to decide which command-line companion to use: https://learning.postman.com/docs/postman-cli/postman-cli-overview/#deciding-which-command-line-companion-to-use My 2 cents: Of course, Newman is not deprecated ( yet ) but I think it can be the case that the Postman team will work more actively on Postman CLI than Newman. If you are an existing Newman user, there is no push right now to move to Postman CLI. However, if you are just getting started with grokking backend automation with Postman then give it a shot to Postman CLI.

How to run your postman (Newman) automation collection in a Continuous Integration environment like Azure DevOps build Pipeline?

  How to run your postman (Newman) automation collection in a Continuous Integration environment like Azure DevOps build Pipeline? Postman Introduction: Postman is a tool that simplifies each step of building and testing APIs. If you've ever used it in your development or testing phase, you must already know what an incredible tool it is. It presents the possibility to automate your API tests and integrate them into your CI/CD pipeline to make certain that any code changes won’t introduce any new regression issues in upper environments like QA, Stage, Production, etc. Newman Introduction: Newman is a tool, using which one can effortlessly run and test Postman Collections directly from the command line. Azure DevOps CI/CD Introduction: Azure DevOps by Microsoft Azure is one of the leading tools that automate CI/CD's process. Using continuous integration and continuous deployment with Azure DevOps, these pipelines are used to construct build-deploy-test workflows used mainl...

NPM: peer dependency is not detected for global packages

  Issue : In npm, peer dependency is not detected for global packages like when you try to install "newman" and then install "newman-reporter-htmlextra" so that you can run Postman/Newman tests collection with htmlextra reporter, it keeps failing because no suitable Newman version is found: npm install -g newman npm install -g newman-reporter-htmlextra newman run "Publish.postman_collection.json" -e QAUS.postman_environment.json -r htmlextra --reporters cli,junit,htmlextra  --reporter-htmlextra-export TestReport.html You may get this error: "npm WARN newman-reporter-htmlextra@1.20.4 requires a peer of newman@^5.1.2 but none is installed. You must install peer dependencies yourself" Solution : Peer dependency and the required package should be installed together like:  npm install -g newman newman-reporter-htmlextra

Steps to execute postman collection through newman

  Here is what you need to do to start executing the postman collection through newman on your system: 1. Install NodeJS – https://nodejs.org/en/download . Click on the 32-bit or 64-bit Windows Installer package, depending on your machine configuration. Skip this if NodeJS/npm is already installed on your system. 2. Open a command prompt, and type “node -v” and "npm -v". These commands should work and provide version number if nodeJS installation is successful. 3. Run this command to install newman:   npm install -g newman 4. Install npm package newman-reporter-htmlextra for creating reports.   npm install -g newman-reporter-htmlextra 5. Pull/Export the collection, environment json (if any), test data csv (if any) files from the Postman UI or code repo (git) to your local and run this command through the folder on your local where you have these files: Command where you have collection json and environment json file : newman run "<<your_collectio...

Tips and tricks for automation using Postman/Newman

   1. How do we run multiple newman/postman collections sequentially (back to back) at one run ? Batch running multiple newman/postman test collections : Create a batch file like this and run: call newman run Collection1.postman_collection.json -e qa1.postman_environment.json -r htmlextra --reporters cli,junit,htmlextra --reporter-htmlextra-export TestReport1.html -d TestData1.csv call newman run Collection2.postman_collection1.json -e qa2.postman_environment1.json -r htmlextra --reporters cli,junit,htmlextra --reporter-htmlextra-export TestReport2.html -d TestData2.csv   Side note : Give a shot to https://medium.com/@mnu/run-multiple-postman-collection-in-parallel-stress-ee20801922ed in case you would like to run it in parallel (P.S. haven’t tried this yet)   2. How can we set environment variable based on another environment variable value ? Like for QA1, we need accountNo say "123" but for QA2, we need accountNo say "345", etc.   pm.tes...