Are you familiar with API endpoint testing? If you’re not, let me give you a quick definition before we go any further.
API testing is a type of software testing that involves testing application programming interfaces (APIs) directly and as part of integration testing to determine if they meet expectations for functionality, reliability, performance, and security. — Wikipedia, API testing
API endpoint testing is one of the most important things we do as web developers. If the routes to reach our data are incorrect, the required parameters are not included, the authorization is missing, or a host of other things aren’t correctly hooked up, your app doesn’t work. If your app doesn’t work, your customers can’t use it. If your customers can’t use it, it’s going to be a really bad day for you, your team, your boss, and so on and so forth.
Which is why we have things like API testing tools. These tools allow us, as web developers, to test that when we pass a specific set of data (or not) to our application it will return the response we expect. It’s a pretty simple idea, but it makes our lives (and development cycles) so much easier.
Note: This will NOT be a blog post about how to use Postman or Insomnia (there’s plenty of those already, including the documentation on their own websites). This will be a comparison of the features the two offer, to help you make a better decision of which to use to suit your dev team’s needs.
API Testing Tools Benefits
Here’s some of the biggest benefits to using an API testing tool, as briefly mentioned above.
- Quicker setup and testing of endpoints (you don’t have to go through the whole user flow to set up data and then execute the commands to change the data),
- Less command line interaction,
- Multiple ways to set up authorization depending on which type you’re using,
- Nicer formatting of code being sent and received,
- Easier performance and reliability testing.
The Contenders: Postman & Insomnia
There’s two popular API testing tools I’ll be talking about today. Postman, a suite of tools which bills its ecosystem as:
“the Only Complete API Development Environment” — Postman
And Insomnia, a REST client which claims you can
“debug APIs like a human, not a robot” — Insomnia
So without further ado, let’s start by seeing what functionalities they share.
What They Both Offer
Insomnia and Postman both share a lot of benefits that are extremely helpful to developers on front-end teams, back-end teams and full-stack teams.
Among other things I’m sure I’m overlooking, both boast:
- A free version of their software for users (upgradeable to more feature-rich paid versions at any point in time),
- Being open source projects,
- Allowing for multiple workspaces (e.g. development, acceptance, prod, etc.),
- The ability to set environment and static local variables that get updated with each call to an endpoint (sometimes referred to as request chaining),
- Allowing for imports and exports of test data for easy sharing between team members,
- The ability to save calls and organize them into folders or collections,
- GraphQL integration and testing options,
- Multiple ways to configure authorizations (OAuth, bearer tokens, Basic, HAWK, etc.) and generate / manage cookies,
- And both have light and dark color schemes, (I know it’s not a big deal, but it’s worth noting. I really prefer developing in a dark IDE to a stark white one).
That’s a good bit of stuff (and I’ll tell you, I’ve used the free versions of both Postman and Insomnia for enterprise level application development, and my teams and I have not felt the need to upgrade to a paid version of either, for what it’s worth).
Ok, now on to some of the unique offerings of both tools.
What’s Unique About Postman
Postman appears to have a much more mature set of products and features when you start to really dive into its documentation.
Here’s some of the things that set Postman apart from other API testing tools.
- API documentation (Postman will generate and host browser-based API documentation in real-time),
- Collection runs (running a group of requests as a series against a corresponding environment — this is super helpful for automated testing, and I love the name of their collection runner: Newman — get it? Newman was the postman on Seinfeld… I love the sense of humor there),
- Monitoring where Postman will periodically run a collection to check for its performance and response,
- And mock servers for teams to simulate each endpoint and its corresponding response in a Postman Collection. Developers can view potential responses, without spinning up a back end, and team members can be aligned on expectations during the earliest phases of API development.
Pretty impressive, right?
What’s Unique About Insomnia
Insomnia, in its defense, has some cool things it offers that Postman does not.
- Template tags (similar to environment variables but they perform operations on things like strings, timestamps, etc.),
- The ability to create new plugins for Insomnia and its user community,
- Client certificate assignments to workspaces and SSL validation (or the disabling of it),
- Code snippet generation in 12 different languages (handy if you want to CURL the command from the command line or drop it in to your actual code base),
- A very thorough documentation area where things like instructions, code snippets and even taste data can be added to specific calls or collections,
- Viewing response beyond JSON and XML (with Insomnia you can see HTML pages, images, SVGs, audio files and even PDF Documents).
Also, useful, handy things to have access to when developing APIs.
Overall, I have to say Postman comes out as the current leader in terms of API testing tools, in my mind. It’s more mature and full featured than Insomnia, offering a lot of really excellent benefits to developers, even in its free tier.
For my teams, who practice fully automated CI/CD testing and deployments, having a test collection runner like Postman offers is a big selling point, and if you’re fully dedicated to supporting an API, having generated, real-time documentation could also be a very nice to have.
That being said, if Insomnia incorporates a few of the benefits of Postman as it continues to develop and improve, there’s no reason it couldn’t continue to be a very strong competitor in the API testing world.
Link to original article.