Welcome to this course about Postman. My name is Harish Rajora and I will be the driver of your ride towards this journey which will take you inside the depths of Postman.
This tutorial is completely designed for you to understand Postman even though you have never heard of Postman or let say API. Since Postman is an API testing tool, we must know what is an API. So in this tutorial we will explore the different topics around API such as
- What is an API
- API Testing
- Role of A software tester in API testing
- API Testing and Unit Testing.
- Area for covering your test
Starting with the first, we will start our journey now with learning about APIs.
What is an API?
API stands for Application Programming Interface. Talking in technical terms an API is a set of procedures, functions, and other points of access which an application, an operating system, a library etc., makes available to programmers in order to allow it to interact with other software. Didn’t get it? Well, neither did I. Let’s break these terms and explore more about APIs.
Taking an analogy here, let say you went to a restaurant. There is no waiter present, so you need to see the menu lying on the table and then make a request to the kitchen where the chef will prepare the dish for you. But it does not always work that way. What if the dish is not available? You will have to go to your seat again and decide something else. There will be many customers present in the restaurant which will slow the process of the chef since now he will be listening to the orders instead of preparing them. Also how can we forget we live in this multilingual world. What if you do not understand the chef’s language? We need a waiter here. A waiter is what can be seen as an API in the internet world. The waiter will come and take your requests, give it to the chef and then in response bring back the food. This waiter is bilingual and speaks both of your (chef and you) languages fluently. What if the dish is not available? Well, waiter knows beforehand you made the wrong request, so he will tell you then and there on the table that the food item is not available. How much time and energy is saved? This is exactly what an API does.
As we visually depict the above analogy using an image, we can see that you are working as an user in the API world. You make the requests while the waiter works as an API who is an intermediary and takes the request to the appropriate server. This server will be processing your request and responding back to you. As said above, your server or application is the chef who is in the kitchen. He will process your request, cook your desired food and present it back to you as a response. The methods and parameters will be discussed in detail later but here in the analogy you can think of it as the special requests you make according to your taste and liking. For example you order something from the menu and describe explicitly that it should be extra spicy. This will help chef to cook according to your demands.
An API takes your requests from the device and fetch the response from the server. Today, API is everywhere. We have achieved so much through APIs, it’s hard to count. If you are into computer science or IT industry, there is no escape from APIs. APIs help you fetch a particular response according to the particular request. For example while you are booking a flight, you will require specific flight results according to the source, destination and departure date and maybe some other variables. For this you might have to visit different airlines to check their different price. But through APIs this is not so difficult. Through different APIs of different airlines, we can get the response of each and every airline for that specific query at one place like GoIbibo does. Maybe now you must have got the idea of how vastly APIs are used today. We all are connected through APIs. All the service that are offered online are mostly through API. As I said, APIs are everywhere
So now that we have established what an API is and why APIs are critical to modern interconnected, globally distributed applications and services, it is important to understand why API testing is critical.
API testing creates a more reliable code. But historically, testing would take place at the GUI level. When a developer would finish their work, they would hand it off to the QA engineer. The engineers had limited time so they would test the code at the highest level – the GUI. This would cover both the front-end and the back-end development.
This worked for manual testing and for the beginning of automation testing, but isn’t right for the age of agile and continuous testing. GUI testing is too brittle, GUI automated scripts break easily and more time consuming. But more importantly, when the application is under developed, teams can’t wait for the entire system to be updated and the GUI to be ready before testing occurs.
In the age of agile, testing must take place at a lower level, i.e at the API level as early as possible. Developers can even do it themselves. API’s can be tested even when the GUI of the application is not yet ready. On top of that API tests, because of “API contracts”, can even be created before development is complete.
An API or rather all the API present in the software/application should be tested perfectly. This is a job of a software tester and bears huge responsibility. A perfect working API leads to the perfect working application. Testing the API solves lot of issues in the application which may arise at some point of time in future. There are many software available for API Testing and one such software is Postman.
Roles & Responsibilities of a Software tester for testing API’s
As a API tester, you should have good architectural knowledge of various web services, REST, SOAP and Micro Services.
- Should able to use all the web methods like GET, POST, DELETE, etc
- Validate the response, response time, error code
- Able to validate the xml and Json body by using Json parsers
- Must know to use OAuth and OAuth2 authentication mechanisms
- Load and Security testing on web services
- Able to read and understand the API documentations
- Able to derive good number of test cases and scenarios.
- Should be good in SQL queries to validate API and DB data elements
- Become master in a tool of your own choice SOAP UI and Postman are not Automation tools. Rest Assured, Rest Sharp, Node modules are the open source libraries for API testing.
API Testing and Unit Testing
API testing and unit testing is considered the same thing by some testers but actually it is different. Unit testing is done by the Developers or by Test Engineers and is done on class by class basis or at the single component level. Motive is to verify whether the module delivers the required functionality. The development team monitors unit testing activity and makes necessary changes wherever required. A major emphasis is on the fact whether each unit or module works perfectly fine in isolation. That is, dependency should be least to ensure a robust module design.
On the other hand, API testing is basically black box testing which is simply concerned with the final output of the system under test. API tests are executed only after the build is ready and portray the system as a whole as it is the user interface that an end user will interact with.
API testing primarily aims to test the business logic layer of the system’s architecture. API testing is primarily handled by the QA team, which requires them to run any API on top of a particular build meant to serve a specific purpose.
API testing also tests the unit as part of a system, while unit testing typically tests the unit in relative isolation from the rest of the system. Hence API testing is also end to end testing. This simply means when we test the complete software in API testing then the modules which make that software are also tested, obviously. But when we do unit testing, we focus only on the functionality of that module and see its working which is completely isolated from the rest of the modules/software.
Area for covering your test
When we test any API through a tool, we face a lot of errors normally. These errors are not only related to only APIs but can vary from software error to server error. This makes the job of a software tester more important and wide than it seems. Since a software is built and delivered in steps, same goes for testing it. When a software is in development stage, the tests and cases are built accordingly. This helps the developers to see any errors of server or network etc. Same goes for any other stage of software such as production stage in which you evolve and upgrade those tests cases. The area for covering your tests should be as wide as possible. It should cover every little possibility of the failure so that the software is built of premium quality and feedback team receives minimum tickets.
With this section, we conclude this tutorial here. Next in this course we will introduce you to the software postman and will download it on our systems. I hope you will enjoy this course with me.