https://autotester.softwareontheroad.com/
It is damn simple to use, just past your JSON API Response on the left side, and click on the arrow symbol to generate your Postman's tests
Did you know that Postman has a brother?
Introducing Newman the CLI version of Postman.
Newman is a command-line collection runner for Postman. It allows you to effortlessly run and test a Postman collection 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.
With Newman, we can run our collections inside a terminal environment. So, that means we can run it inside a Continuous Integration tool!
How to use it:
npm install -g newman
newman run examples/sample-collection.json
I like to use CircleCI, but the process is almost identical for other CI tools like Github Actions, Jenkings, or TravisCI.
version: 2
"integration-test":
docker:
- image: circleci/node:12.18.2-buster
- image: circleci/mongo:4.2
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: npm install
- run: sudo npm install -g newman
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run:
shell: /bin/sh
command: wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 10 http://localhost:8080
- run:
command: newman run ./tests/integration/softwareontheroad.com.postman_collection.json -e ./tests/integration/softwareontheroad.com.postman_environment.json
environment:
MINUTES_RATE_LIMIT: 1
ATTEMPTS_RATE_LIMIT: 2
"deploy":
docker:
- image: circleci/node:12.18.2-buster
working_directory: ~/repo
steps:
- checkout
- run:
name: Deploying Server to Heroku...
command: |
npm run deploy:heroku
workflows:
version: 2
build_and_deploy:
jobs:
- integration-test
- deploy:
requires:
- integration-test
filters:
branches:
only:
- production
- master
We took advantage of a not so spoken feature of Postman, the test tab.
Then we created simple assert tests for our API endpoints - we can use this tool that I created for this article.
Lastly, by using Newman we run our tests inside a CI environment.
Now you can go and ask your manager for a rise!
I wish postman has any kind of affiliate program, I talk very well about it.
But this is my way of paying them back, thanks for all of these years of saving my ass. Sam.
Join the other 2000+ savvy node.js developers who get article updates. You will receive only high-quality articles about Node.js, Cloud Computing and Javascript front-end frameworks.