Brand new so please put up with my bad terminology here. Can a collection run either on my workstation or in the cloud as a service? Specifically, I am looking to send a HTTP request to the Postman Collection with an Id and have Postman perform a GET request with the Id and reply back with the resulting binary stream. Is this something Postman can do?
Both these things are possible! You can run a collection using our command line runner newman: https://www.npmjs.com/package/newman or use Postman Monitors to schedule runs: https://www.getpostman.com/docs/postman/monitors/intro_monitors.
You can also run a monitor through our API: https://docs.api.getpostman.com/#5b277ca0-7114-e04e-f1f5-246fbbd6d973 on demand. Do note that the monitoring service is charged on a per-request basis.
Great! Will any of these solutions function continuously as in run as a service without manual intervention once deployed?
Hi @hakker! Monitors you can set up to run at specific times based on minutes, hours, and/or days. So, for example, you can set up a monitor to run every 5 mins, every 6 hours, or every Monday at 9am. With Newman or our API you can write a quick script with a cron job to schedule runs, though it will take slightly more effort than our built-in monitoring feature
A few months ago, I had a cron job running a script with a Newman collection and it was so helpful.
I tried it again and now it fails. Running the script by hand generates the html report just fine, but when run through cron, the cli and html output are blank. Has something changed? I’m certain I’ve got the proper cron permissions … cron is able to modify and write to other files in the same directory … it simply won’t generate the cli or html output from Newman.
Did something change? Do I need a new option? (Please don’t tell me to buy the Enterprise version to use Monitor – it’s out of the question for this project.)
@jaimeschatz Could you check the
cron error logs for any clues on this? Also, could you share the Newman version being used, along with the command used to run the collection and generate reports? Thanks!
Thank you, @kunagpal for your help troubleshooting. I’ve been pulling my hair out over this for several days now.
Newman version 3.9.3
Command in script:
newman run /home/teamname/tests/vm_smoke_tests.json -e /home/teamname/tests/environmentname_env.json --reporters html,cli > results.txt
Again, when I run the script manually (typing ./scriptname.sh at the command line), the script performs as expected, with Newman generating the expected cli and html output files. When run in cron, Newman doesn’t generate anything. I am able to write, modify, etc. files from the exact same script run from cron.
For example, this line in the same script posts this line to the file specified:
echo “I have just run the Newman tests and want to write this to a file” > /home/teamname/results/$today/text-$ts.html
I’ve also tried different variations to see if I could pin down another issue:
newman run /home/teamname/tests/vm_smoke_tests.json -e /home/teamname/tests/environment_env.json --reporters cli,html --reporter-html-export “/home/teamname/results/$today/$ts” > results.txt
newman run /home/teamname/tests/vm_smoke_tests.json -e /home/teamname/tests/devint_env.json --reporters html --reporter-html-export “/home/teamname/results/$today/$ts”
($today and $ts are set earlier in the script: today=
date +%Y-%m-%d and ts=
Here’s the latest output from the cronlog:
Mar 1 09:17:01 servername CRON: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Mar 1 09:19:01 servername CRON: (username) CMD (/home/teamname/tests/run_and_post_smoke_test_results.sh)
Mar 1 09:19:02 servername CRON: (CRON) info (No MTA installed, discarding output)
I think the MTA message regards email – this server is not designed to email. I attempted to redirect the output and only got the standard expected cli output from my script:
Setting variables, naming files and directory
today’s directory exists: /home/teamname/results/2018-03-01
Running tests. Sending results to /home/teamname/results/2018-03-01/20180301-0922
Checking for failures.
Checking for errors.
Moratorium on Cleaning up. - check results.txt file
the results.txt file is blank, but the file I modified in the script has the expected line.