Ridiculously Easy API Testing: Introducing Jetpacks for Postman
Fred Brooks in his seminal book “The Mythical Man Month” gave the following ideal distribution of time spent on a software project:
- 1/3rd to planning
- 1/6th to coding
- 1/4th to component testing and early system testing
- 1/4th to system testing with all components in hand.
Even if the exact break up between tasks varies in different environments, it’s evident that testing software requires a great deal of more time than actually writing software.
Integration between different parts of a system is a big challenge. Still with limited time and a limited budget, the first thing that’s cut off from the development schedule is rigorous testing. This has massive hidden costs. If the current state of security flaws and breakdowns of apps and portals is any indication, even experienced teams face difficulties. And for startups and small development teams, testing becomes a luxury and often the first casualty.
Compared to the amount of time we spend in honing our development tools, we spend far lesser on testing tools. Setting up a testing environment can be time consuming. And sometimes really boring. There is a lot of boilerplate code required to start testing even simple things. Writing tons of code just to initialize stuff puts off beginners and experts alike and proper API testing is limited to a few privileged projects.
To solve these problems, Postman now features a brand new update called Jetpacks. The Jetpacks upgrade allows you to improve your workflow as well as provides a kick-ass environment for API testing:
Start adding tests to your requests with a single click: There is no set up required. Everything that you would need to test your API response is included. Postman includes several libraries to make sure that you don’t have to write extra code. Specifying tests can be as simple as a single line of code. Some of the most common scenarios are listed in the Snippets sidebar so that you don’t have to read the documentation. Though if you want to, it’s available here.
No limits on test or request iterations: In the Collection Runner window, you can choose a collection (a set of requests), an environment and then set the number of times you want to run a collection. There is no limit to the frequency and the iteration count.
Chain requests together: Environment and global variables can be set inside the JS test script. You can extract data from one request and use it inside another request. This allows you to chain multiple requests together.
Mock data for tests: Postman allows you to import a CSV or a JSON file while running a request. Data variables follow the same format as the environment and global variables. You can test all possible scenarios for your API with absolutely no change or repetition for your existing requests.
Make your collections self aware: If you are distributing your API through a collection, you can add checks for your API consumers to ensure that everything works properly when she tries out your API. Instead of a vague “it doesn’t work” email, your consumers can tell you exactly what’s not working.
Check out the documentation for more details on what you can do with Jetpacks.
The Jetpacks upgrade is now available in the packaged app version of Postman. To activate the upgrade, click “Collection runner” or Know more in the “Tests” tab and then press the buy button. The upgrade is available for $9.99. All future upgrades for features as part of Jetpacks would be free!
If you have donated to the Postman project you have the option to avail this upgrade for free. Shoot me an email at email@example.com for activation instructions.
There are several other exciting updates in the pipeline. Support for Continuous Integration and build systems is coming soon.
As Brooks noted in his “No Silver Bullet” essay, there might not be a magic solution for dealing with the complexity of the software development process. However, I am sure using Postman to write tests will make your development life easier, lead to increased productivity for your team, and result in robust APIs while reducing development costs as well as the ones which you incur when your API stops working.