Postman is an API testing tool which offers a smooth user interface to test an API’s functionality. API is the acronym of Application Programming interface which is a set of programming code that allows data transmission between one software product and another.
Postman tool is developed by Abhinav Asthana and founded a company. Currently, he with his two colleague Ankit Sobti and Abhijit Kane together serves the leading positions.
WHY POSTMAN ???
- Easy accessibility to use Postman tool. Just sign-in and access files at any time.
- Postman is free to download and use for teams of any size.
- Postman allows users to create collections for their Postman API calls. Each collection can have subfolders and multiple requests. This helps in organizing your test suites.
- It is easy to share files in postman. Collections and environments can be imported and exported by sharing the direct link.
- Having multiple environments aids in less repetition of tests as one can use the same collection but for a different environment. This is where parameterization will take place which we will discuss in further lessons.
- Test checkpoints such as successful HTTP response status and API response time can be added to each Postman API calls which help ensure test coverage.
- Postman console helps to check what data has been retrieved making it easy to debug tests.
- Save time for repetitive tests using the Collection Runner or Newman, tests can be run in multiple iterations.
- Postman supports continuous integration.
Advantages and Disadvantages of Postman.
- User friendly and simple interface.
- Supporting all HTTP methods.
- Easy to access from application or browser with an account.
- Easy tracking with several status codes.
- Limited testing area.
- Unable to use pre-written scripts for different projects.
- Constrained integration.
How to start postman???
5 simple steps to start Postman –
- Go to https://www.postman.com/ and download postman for the desired operating system.
- Install the Postman.
- Signup/ Create account for Postman.
- Set up the workspace tools and Save preferences.
- Postman is ready to use.
Postman has following components-
- Left side give access to Collections, APIs, Environments, Mock servers, Monitors, Request history.
- Header which allows you to create workspaces, access reports, search, explore public API network, invite collaborators, capture request and cookies, settings, accounts, Postman plan.
- Center area – main working area.
- Status Bar – containing console, collection runner, trash, two pane view, help.
Postman Rest API Methods-
REST – REST stands for Representational State Transfer. Any web service that is defined on the principles of REST known as a RestFul web service.
HTTP– The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. This is the foundation for data communication for the World Wide Web (i.e. internet) since 1990. HTTP is a generic and stateless protocol which can be used for other purposes as well using extensions of its request methods, error codes, and headers. The default port is TCP 80, but other ports can be used as well. It provides a standardized way for computers to communicate with each other. HTTP specification specifies how clients’ request data will be constructed and sent to the server, and how the servers respond to these requests.
A Restful service would use following HTTP methods like GET, POST, PUT, DELETE etc. for working with the required components. REST was designed specifically for working with components such as media components, files, or even objects on a particular hardware device. Postman use REST API to call web services.
Lets start accessing REST APIs –
GET Method : This method is used to retrieve information from the given server using a given URI. Requests using GET should only retrieve data and should have no other effect on the data.
GET Method with test cases –
Predefined Test cases – There are some predefined test cases which we can use directly.
POST Method : A POST request is used to send data to the server, for example, customer information, file upload, etc. using HTML forms. Basically POST method is used to insert data.
PUT Method : PUT is used to send data to a server to create/update a resource. Replaces all the current data of the target resource with the uploaded content.
DELETE Method : This method deletes the specified data.
Remaining HTTP Methods –
PATCH Method : PATCH is used to update partial resources. For instance, when you only need to update one field of the resource, PUTting a complete resource representation might be cumbersome and utilizes more bandwidth.
HEAD Method : HEAD is almost identical to GET, but without the response body. HEAD transfers the status line and the header section only.
OPTIONS Method: The OPTIONS method describes the communication options for the target resource.
LINK Method : The LINK method is used to establish one or more relationships between an existing resource identified by the effective request URI and other resources.
UNLINK Method: The UNLINK method is used to remove one or more relationships between the existing resource identified by the effective request URI and other resources.
COPY Method : This method will copy an resource, like if I want to copy an object or entity on server I can use it.
Postman is a powerful HTTP client for testing web services. Postman makes it easy to test, develop and document APIs by allowing users to quickly put together both simple and complex HTTP requests. Postman is a powerful tool and can help API developers ensure consistency and efficiency. Also it is a useful tool for both automated and manual testing process.