30 Days of API Testing - Day 1: Define API testing


(Han Ho) #66

Thank you for your useful information. Bellow is all that I understand about API & API testing:

APIs (Application Programming Interface) are used to integrate systems together. You can make data available for other systems to access via API or accept data from other systems. Usually API work similarly to the way any website works. A request is made from the client to the server and we get the response over the http protocol.

The following example can help you easy to imagine:
The best analogy can be a waiter in a restaurant. The Waiter takes the request (which is the order for food) from the customers and conveys it to the kitchen (which is our server) and gets the food (response) from the kitchen to the customers. APIs do the exact same thing. An API is the messenger that takes your request and tells the systems what to do and then returns the response back to you.

image

What is API Testing?
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. Since APIs lack a GUI, API testing is performed at the business layer. During the API testing the data is exchanged from XML or JSON through HTTP requests and responses. These are technology independent and will work with any of the programming languages and technologies.

There are 3 main reasons you should invest in API testing:

  • Testing the application early and without a user interface. The later you find defects, the more expensive they are to fix. API testing engages testers early in development lifecycle. With API testing you can start testing your application early even without a UI.

  • To come up with an awesome test automation strategy and reduce the test automation costs.

image

As we move up the pyramid, the cost involved in the creation and maintenance of test, the test execution
time, test fragility and test coverage keeps increasing. The automation pyramid preaches that you should
do much more automated testing through unit tests and API tests than you should through GUI based
testing.

  • Agile Software development and reduced manual regression testing. Test automation has become a critical factor to maintain agility. So it is necessary for agile teams increase their level of API testing while decreasing their reliance on GUI testing. API testing is recommended for the vast majority of test automation efforts.

More information, Please refer here: https://guide2mobiletesting.blogspot.com/2017/01/how-api-testing-has-changed-way-we.html


(khanh nguyen) #67

After a few days researching API testing, I have some general ideas to share to some who are still newbies to it:
1. What is 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.
Given an analogy to make it more easier to understand:
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?

In this scenario, a waiter is necessary and he is playing a role like an API that takes a request from a customer, sends it to the chef and in response bring in the food to the customer. If the dish is not available, the waiter will tell the customer.

Meanwhile, the waiter is speaking the language that both customers and chefs understand.
In general,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. This is how API works.

2. What is API testing? Why API testing?
API testing is a type of software testing that involves testing APIs directly and also as a part of integration testing to check whether the API meets expectations in terms of functionality, reliability, performance, and security of an application. In API Testing our main focus will be on Business logic layer of the software architecture.

Why we need to use API testing?
Before, Testing would often take place at the GUI level. This often leads to the facts that enginneers have short time to test their products, critical bugs cannot be detected early which take a lot of efforts to fix.
In the age of agile, to adapt quick releases and versatile needs from customers, testing must happen at the lower level. While GUI is not ready, teams still are able to test their product effectively.

3. What needs to be verified in API testing?

  • Data accuracy
  • HTTP status codes
  • Response time
  • Error codes in case API returns any errors
  • Authorization checks
  • Non functional testing such as performance testing, security testing

For more details, please refer here:
https://www.toolsqa.com/postman/api-testing-with-postman/

These are my understanding on API testing, what about yours? :sunglasses: