We have been using Postman to test our APIs and ensure the system behaves correctly for new releases. Postman is itself a great app which helps programmers to improve their experience in testing HTTP requests.
We started by using it for development where programmers can use it to learn and discover the APIs and inspect its responses, which they can use to discover the data structure and then add it into their codes.
Also, at times, they find bugs from server responses where the responses are not as expected or perhaps missing some information.
This is good as they can share collection (as a form of communication) to server team to request for bug fixes and changes.
Later part, we automate testing on our server by using postman collections as the tests itself.
This is made possible thanks to newman CLI, also created by the creators of postman. Our appetite for postman collection grew faster as we need to have more comprehensive tests for our new releases.
However, after using it in our workflow, we find that it is easier to edit the collection using code editor as the collection itself is JSON texts.
Here are some of our pains in using Postman:
- Postman app takes awhile to load, not to mention the memory and CPU usage
- Not able to load or save file easily – need to import / export collections and the sidebar list of collections is too long
- Too many steps needed which interrupts the natural flow
- Collection files are verbose
- Hard to read and edit, due to JSON’s limitation
- JSON payloads are stringified and stored as a long line.
- Prerequest and test scripts are all quoted in string with \\n and other escape sequences
- Isn’t diff friendly, which is important for code reviews
In a way, it can be edited but it distract the flow of the artist in work when they are deep in thoughts.
Then, we came up with an interesting idea, how about turning the JSON to YAML as it is readable and improve productivity of the programmers that are going to maintain it.
That is where we created “pm+”, which is a handy tool that allow programmers to work with postman collection without the
Some YAML goodness:
- Array and objects are readable, similar to markdown
- It almost looks like a markdown document
- Scripts and JSON payloads looks natural and editable
- Since it’s readable, it’s diff-friendly!
Our wish is that there’s a way in YAML to syntax highlight on each part of the content – and guess what, we found something close from a Color Theme in VSCode that does just that.
Only small inconvenience is the javascript in the test is not syntax-coloured according to javascript but just text.
What can pm+ do for you?
It can convert existing postman collections to our new YAML format and back again.
However, take note that when pm+ converts to YAML, it removes the ids which seems to be optional.
Also, since we learnt that importing from curl makes our flow even easier, we can get the QC team to “Copy as CURL” from browsers.
And pm+ can convert them too.
pm+ is open source, you can find it in our GitHub repo
Well, there you go… we hope that pm+ can improve the productivity of programmers. Enjoy!
Our wish for newman, no need to sandbox the scripts. We should be free to use and require any modules we need. There are some tests that we need the full capability of node to automate…