Top 20 API Testing Interview Questions | API Testing Interview Questions

Below are the Top 20 API Testing Interview Questions based on the candidate's experiences and the company's interview pattern.  

 

1. What is API Testing?
API testing is a kind of software testing that determines if the developed APIs meet expectations regarding the functionality, reliability, performance, and security of the application.
 
2. What are the advantages of API Testing?  
1) 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.
2) 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 cost-saving for the testing project.
3) Language-Independent: In API testing, data is exchanged using XML or JSON. These transfer modes are completely language-independent, allowing users to select any coding language when adopting automation testing services for the project.
4) 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.
 
3. What is API?
API (Application Programming Interface) helps in communication and data exchange between two software systems. API act as an interface between two applications and allows the two software systems to communicate with one another. API is a collection of functions that can be executed by another software program.
Example: google API

 

4. What are the types of API testing?
API testing involves the following types of testing:
 
1) Unit Testing
2) Functional Testing
3) Load Testing
4) Runtime/Error Detection
5) Security Testing
6) UI Testing
7) Interoperability and WS compliance Testing
8) Penetration Testing
9) Fuzz Testing
 
5. What are the protocols used in API Testing?
Protocols used in API testing are:
 
1) HTTP
2) REST
3) SOAP
4) JMS
5) UDDI
 
6. What are the tools used for API Testing?
Tools used for API testing are:
 
1) Postman
2) SOAPUI
3) Rest assured
4) Karate API
 
7. What are common HTTP Methods?
1) GET
2) POST
3) PUT
4) DELETE
5) PATCH

 

8. What exactly needs to verify in API testing?
In API testing, we send a request to API with the known data and then analyze the response.
1) We will verify the accuracy of the data.
2) We will see the HTTP status code.
3) We will see the response time.
4) Error codes in case API returns any errors.
5) Authorization would be check.
6) Non-Functional testing such as performance testing, security testing.

 

9. What are the differences between API and Web Services?

Sr. No

API

Web Service

1.

API may or may not need network for its operations.

Web Services always need network for its operation.

2.

API can be communicated through SOAP, REST, XML-RPC, and CURL calls as well.
API can also be exposed in a number of ways like JAR, DLL, XML over HTTP, JSON over HTTP etc.

Web service can be communicated through SOAP, REST, AND RPC.

3.

API can perform all the operations that web service can't perform.

Web services can't perform all the operations like API.

4.

All APIs are not web service.

All web services are API

 

10. What is the most used template for API documentation?
Here, are the various documentation template that makes the whole process simple and easy. They are:
1) Swagger
2) Miredot
3) Slate
4) FlatDoc
5) API blueprint
6) RestDoc
7) Web service API specification
 
11. What are the major challenges faced in API testing?
 
1) Parameter Selection
2) Parameter Combination
3) Call sequencing
4) Output verification and validation
5) Another important challenge is providing input values, which is very difficult as GUI is not available in this case.
 
12. What are RESTFul Web Services?
Mostly, there are two kinds of Web Services that should be remembered in your next API testing interview:
 
1) SOAP (Simple Object Access Protocol) – an XML-based method to expose web services.
2) Web services developed in the REST style are referred to as RESTful web services. These web services use HTTP methods to implement the concept of REST architecture. A RESTful web service usually defines a URI, Uniform Resource Identifier a service, provides resource representation like JSON and a set of HTTP methods.

 

13. Which protocol is used by RESTful Web services?
RESTful web services use the HTTP protocol as a medium of communication between the client and the server.
 
14. Can GET request to be used instead of PUT to create a resource?
The PUT or POST method should be used to create a resource. GET is only used to request data from a specified resource.
 
15.  Is there any difference between PUT and POST operations?
POST is used to create a resource and PUT is used to update a resource.
 
16. What are SOAP Web services?
This is one of the fundamental Web services testing questions that you must know the answer. The SOAP (Simple Object Access Protocol) is defined as an XML-based protocol. It is known for designing and developing web services as well as enabling communication between applications developed on different platforms using various programming languages over the Internet. It is both platform and language independent.

 

17. What are the differences between SOAP and REST API?

Sr. No

Soap API

Rest API

1.

SOAP stands as Simple Object Access Protocol.

REST stands as Representational State Transfer.

2.

SOAP is a protocol.

REST is an architectural pattern.

3.

SOAP can work with XML format. In SOAP all the data passed in XML format.

REST permit different data format such as Plain text, HTML, XML, JSON, etc. But the most preferred format for transferring data is in JSON.

 

18. What is messaging in RESTFUL Web Services?
RESTFUL Web Services use the HTTP protocol as a communication tool between the client and the server. This is the technique when the client sends a message in the form of an HTTP request the server sends back the HTTP reply which is called Messaging. This message consists of message data and Metadata i.e. information on the message itself.
 
19. When we can use SOAP API?
We can use SOAP API to perform the operation on records like create, retrieve, update or delete. We can use API to manage passwords, perform searches, etc.
 
20. What is URI? What is the purpose of a web-based service and what is its format?
URI stands for Uniform Resource Identifier. It is a string of characters designed for unambiguous identification of resources and extensibility by the URI scheme. The purpose of URI is to locate the resource on the server hosting of the web service.
A URIs format is <protocol>://<service-name>/<Resource Type>/<ResourceID>