When comparing Mocha vs Postman, the Slant community recommends Postman for most people. In the question“What are the best frameworks to test REST server?” Postman is ranked 1st while Mocha is ranked 2nd.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Supports different assertion libraries
Mocha runs independently from the assertion library, so you can choose which assertion format works best for you.
Mocha most often is run in combination with assertion library Chai.
Pro Write tests with Behavior Driven Development (BDD)
Allows developers to choose their development process. Not only TDD but also BDD.
Pro Runs in Node.js and the browser
Mocha has a browser build as well as a node command line program so you can test in client and server side environments.
Pro Makes Asynchronous testing extremely easy
No need to write tricky statements for Async testing. Mocha gives you a done
callback. Place this done
parameter in your callback function, that'll let Mocha know that you've written an asynchronous function.
Pro Integrates really well with NodeJS
The Mocha test framework itself runs on NodeJS, hence it makes everything related to it extremely simple. With Mocha's simple syntax and speed, testing your node.js app just got a whole lot easier.
Pro Custom full color test reporters
Mocha has multiple test reporters built in and you can create your own as well. The test reporters have full color and makes it easy to see if your tests fail or not.
Pro Easy to add support for Generators
Aside from the numerous benefits with generators in your application, You can now also integrate generators into your test suite. By using mocha, all you have to do is enable support for generators.
Pro Free
Pro Flexible and powerful
Can easily add/remove parameters, headers, tests and more. Displays all the info you would want in a partitioned way so you can track exactly what you want. Able to save request and run them in bulk for testing real-user scenarios very efficiently.
Pro Clear interface
The interface of the program is clean and intuitive. Almost all features are accessible through a single click.
Pro Two versions of apps are available
Packaged app and an in-browser app are available for Google Chrome.
Pro Excellent user feedback loop
Postman is very responsive to users and listens to user feedback.
Pro Dark theme
Cons
Con Can be intimidating for beginners
While some testing frameworks are complete out of the box, Mocha requires developers to select and set up assertion libraries and mocking utilities. For someone who is just starting to learn how to build tests this can be scary as they will also have to choose which libraries to use and learn them too.
Con No atomic tests
Tests cannot be ran in random order.
Con Version 8.x killed Postman - some problem related to "Teams"
Postman is forcing everybody to move their data to the cloud.
Con Insecure off-premise storage
To properly use this with full development and testing it stores API details, including security, in an off-site storage managed by Postman. It also stores details about employees, teams they are members of, and projects they are working on.
This makes it inappropriate for any organization that is required to exercise a high level of security hygiene when developing software products. This issue may be compounded by the lack of details concerning the geolocation of data storage.
Con Proprietary, closed source software
Not free and open source.
Con Resource hog
Con Bloated & cluttered
Bloated and cluttered, it's quicker to just have a js/ts template available to run some requests.