Automate Postman Tests with Newman

0

Category : , , ,

Newman is a command-line collection runner for postman.

1) So the first step is to export your collection and environment variables.

2) Save the JSON file in a location you can access with your terminal.

3) Install Newman CLI globally, then navigate to the where you saved the collection.

4) Once you are in the directory, run the below command, replacing the collection_name with the name you used to save the collection.
newman run "collection_name.json" -e GITHUB_ENV.postman_environment.json
5) Ensure you add the -e flag which is for the environment param.

6) You may also want to specify the -d flag for a data file and the --insecure switch to allow calls to self signed certs.


You should see something like the below:





my thanks to the great article below.
https://scotch.io/tutorials/write-api-tests-with-postman-and-newman#newman-cli

Postman BDD allows you to use BDD syntax to structure your tests and fluent Chai-JS syntax to write assertions. So the above test suite could look like this instead:
https://github.com/BigstickCarpet/postman-bdd

API Test Automation CI using GitHub, Jenkins, and Slack

First few steps are the same as above i.e. export the postman tests and environment.

Probably start at Step 2: Setup Your Jenkins Build

npm commands

Get npm installed version
npm -version
Get npm installion directory
npm root -g
Get list of installed packages
npm list -g --depth=0


my thanks to the great post below:
https://www.linkedin.com/pulse/api-test-automation-ci-using-github-jenkins-slack-talal-ibdah?trk=mp-reader-card

0 comments:

Post a Comment