Introduction to Postman: API Development Platform
Introduction to API
Application programming Interfaces (API) are all over the Internet and they play a significant role in the day-to-day life of end users and we use it even without realizing it. Right from checking weather reports, booking hotels, login to google or social media accounts, choosing online payment methods while shopping on ecommerce sites everywhere APIs are used to create a better experience for us in the digital world.
Although APIs are making our lives easier, developers need to test them before using them on real time data. And at that point in time Postman was introduced, it is used by more than 7 million developers worldwide every month.
In this article we will learn more about the Postman tool, testing APIs with Postman, testing automation and much more.
What is Postman?
There are a number of ways in which APIs can be created, a web API is usually made using the REST (Representational State Transfer) framework. The REST framework sets a set of guidelines which should be followed while developing APIs. API is created to enable other applications to use the services, every stage in API development process involves testing, testing for functionality, handling exceptions, and security.
The Postman tool is much more than a simple API testing tool. Postman tool allows you to organize your API requests into collections and folders that share common values across requests with environment variables, script tests with built-in-node.js based runtime, and automate them with Newman – the command line runner for Postman.
It is a complete testing tool and a complete API development platform having various built-in tools which support every stage in API lifecycle. Postman tool allows to design, mock, debug, automate testing, document, monitor and publish APIs from a single place. Postman can be accessed via native apps for MacOS, Windows and Linux operating systems.
Evolution of Postman
The initial Postman was a Postman chrome App and used along with the Postman interceptor Chrome extension. The Google Postman extension was more widely accepted.
Pros of Postman
- Creation of test suites with ease – to ensure that API is working as required, Postman tool allows to create a collection of integration tests and for each test which runs in a specific order, an HTTP request is made and assertions written in JavaScript are used to ensure code integrity. It gives freedom to manipulate data which you receive from Postman application
- Supports testing on different environments – the local environment is usually configured in a different way than test server, test collection which runs perfectly in test environment, may give issues in actual environment. The Postman tool allows you to store certain information about the different environments that you can use and automatically insert the correct environmental configuration for the test collection which you are running.
- Data Storage – Postman tool allows to store data from previous tests into global variables, and these can be used in a similar fashion as environmental variables. We can either store the response or some portion of the response and use it for calling subsequent APIs.
- Better integration – it is a unique interface which allows easily running a collection of tests right from the command line. Newman’s Postman command line interface (CLI) enables running the tests on systems not having GUI interfaces. It gives the ability to run a collection of tests from within most build tools.
Features of Postman
- Accessibility – is at ease one can login to their account and access files anytime
- Collection usage – it allows users to create collections of API calls
- Combination – collections and environments can be imported with ease or exported to share files
- Establishing environments – multiple environments can be setup to reuse same collection for different environment
- Creation of test cases – multiple test cases can be created to ensure complete test coverage
- Process automation – use of the collection Runner or New man, tests can run in multiple iterations to save time for repeat tests
- Data debugging – Postman console check what data has been retrieved to make debugging simpler
- Continuous integration – development processes can be maintained with continuous integration support
Using Postman to Automate API testing
It has a user-friendly interface which allows it to send API requests. We can create a new request or collection. HTTP requests such as POST, GET, DELETE etc. are listed to be chosen as per the need. In the Request URL tab you are required to enter the endpoint URL and click the Send button to send a request to the intended URL and receive a response.
Authorization is one feature which is required when we deal with a URL which is not open publicly and should have a username, token or password to use. As per the requirement Header with content type as JSON can be set.
Import function allows you to import an existing collection when Runner allows to execute automation tests.
Automated API testing is divided into four steps starting with manual testing of the APIs, then API response is received, based on previous two steps one can write test suites and execute these test suites from different endpoints and gather the results.
Continue Reading:
Understanding REST and REST API
What is JSON? Why JSON is better than XML?
Tag:software