API Testing Interview Questions & Answers

Question: What is an API?


An API (Application Programming Interface) is a software intermediary that enables two applications to communicate with each other. It comprises a number of subroutine definitions, logs, and tools for creating application software.

In an API testing interview, you could be asked to give some API examples, here are the well-known ones: Google Maps API, Amazon Advertising API, Twitter API, YouTube API, which can be used to perform different CRUD Ope

Question: What are main differences between API and Web Service?


All Web services are APIs but not all APIs are Web services.

Web services might not contain all the specifications and cannot perform all the tasks that APIs would perform.

A Web service uses only three styles of use: SOAP, REST and XML-RPC for communication whereas API may be exposed to in multiple ways.

A Web service always needs a network to operate while APIs don’t need a network for operation.rations.

Question: What are some architectural styles for creating a Web API?


Below are four common Web API architectural styles:

a) HTTP for client-server communication

b) XML/JSON as formatting language

c) Simple URI as the address for the services

d) Stateless communication

Question: Who can use a Web API?


Web API can be consumed by any clients which support HTTP verbs such as GET, PUT, DELETE, POST. Since Web API services do not require configuration, they can be easily used by any client. In fact, even portable devices such as mobile devices can easily use Web API, which is undoubtedly the biggest advantage of this technology.

Question: What is API Testing?


API testing is a kind of software testing which determines if the developed APIs meet expectations regarding the functionality, reliability, performance, and security of the application.

Question: What are the advantages of API Testing?


a) Test for Core Functionality: API testing provides access to the application without a user interface. The core and code-level of functionalities of the application will be tested and evaluated early before the GUI tests. This will help detect the minor issues which can become bigger during the GUI testing.

b) Time Effective: API testing usually is less time consuming than functional GUI testing. The web elements in GUI testing must be polled, which makes the testing process slower. Particularly, API test automation requires less code so it can provide better and faster test coverage compared to GUI test automation. These will result in the cost saving for the testing project.

c) Language-Independent: In API testing, data is exchanged using XML or JSON. These transfer modes are completely language-independent, allowing users to select any code language when adopting automation testing services for the project.

d) Easy Integration with GUI: API tests enable highly integrable tests, which is particularly useful if you want to perform functional GUI tests after API testing. For instance, simple integration would allow new user accounts to be created within the application before a GUI test started.

Question: Some common protocols used in API testing?



Question: What are principles of an API test design?


The five most important principles of an API test design are:

a) Setup: Create objects, start services, initialize data, etc

b) Execution: Steps to apply API or the scenario, including logging