API TESTING INTERVIEW QUESTIONS
API stands for Application Programming Interface. Generally, APIs are used to establish the interaction between two different applications. When API is used over a web network, we call them ‘Web Services’. In recent times APIs have become the backbone of programming. As in an application, writing APIs to communicate with the database, or with another module has become a common practice now and that is why as a tester we must test the APIs for maximum test coverage.
Challenges are for example,
Access to the database
This is the most common API testing interview question these days.
- Firstly, the POST request means creating a new object in the database.
- Secondly, a PUT request means updating the existing object in the database with the new value.
GET- Used to retrieve data from the serverPOSTcreate a new object in the server
PUT- Used to update an existing object in the serverDELETEused to delete data from the server
- Session / Cookies based Authentication
- Basic Authentication
- Digest Authentication
Above all are the few most important authentication techniques.
REST — Representational State Transfer, is a set of functions that helps developers performing requests and receive responses. Interaction is made through HTTP protocol in REST API.
Accuracy of data
HTTP status code
Error codes if API returns an error
Above all are the most important verification checks.
UI (User Interface) testing means testing the graphical user interface. The focus of UI testing is on the look and feel of the application. Like how the user interacts with the application elements, such as images, font, layout, etc.
API testing allows communication between two software systems. It determines if the developed APIs meets the expectation regarding functionality, reliability, performance, and security. It works on the backend and also knows and the backend testing. To clarify, describe some scenarios while answering this question in an interview.
RESTFUL web services use the HTTP protocol as the medium of communication between client and server.
Yes, we can because POST is the superset of all HTTP requests except GET requests.
Payload/body is a secured input data that is sent to API to process the request. The payload is generally constructed in JSON format in REST API.
- All web services are APIs but not all APIs are web services.
- 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.
- Web services might not contain all the specifications and cannot perform all the tasks that APIs would perform.
- Compatibility and easy integration with GUI: Simple integration would allow new user accounts to be created within the application before a GUI test started.
- Language-Independent: In API testing, data is exchanged using XML or JSON. These transfer modes are completely language-independent that allows users to select any coding language while adopting automation testing services for the project.
- Time Effective: In comparison to functional GUI testing API testing usually is less time-consuming. 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.
- Test for Core Functionality: API testing provides the ability to access the application without a user interface. The core and code-level functionalities of the application will be tested and evaluated early before the GUI tests. This helps in detecting the minor issues which can become bigger during the GUI testing.
We often need to automate the test cases which are repeatedly executed in every sprint. Like regression cases. Similarly, in the case of API testing, there are some cases that we need to execute before every release and those cases should be automated.
There are many tools for API automation like-
Theoretically, one can pass unlimited data as the payload to the POST method. But, while considering a real use case, then sending a POST with a large payload will consume large bandwidth. It will take more time and cause performance challenges to the server.
The REST API has four types of parameters:
Request parameters — These are submitted as JSON parameters present in the request.
Header parameters — These are present in the request header.
Query string parameters — These are provided at the endpoint of the query.
Path parameters — These are provided in the endpoint path.
For the complete list of API Testing Interview Question visit: