API Testing Interview Questions – Set 01

What is the most used template for API documentation?

Here, are the various documentation template that make the whole process simple and easy. They are:

  • Swagger
  • Miredot
  • Slate
  • FlatDoc
  • API blueprint
  • RestDoc
  • Web service API specification

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 password, perform searches etc.

What are the types of API testing?

API testing involves the following types of testing:

  • Unit Testing
  • Functional Testing
  • Load Testing
  • Runtime/Error Detection
  • Security Testing
  • UI Testing
  • Interoperability and WS compliance Testing
  • Penetration Testing
  • Fuzz Testing

What is a RESTFUL web services?

There are two kinds of web services

  • SOAP Web Services
  • RESTFUL Web Services
    1. SOAP (Simple Object Access Protocol) – SOAP is a XML based method which is used in Web Services.

2. RESTFUL Web Services – To implement the concept of REST architecture HTTP method is used. RESTFUL Web Services defines URI (Uniform Resource Identifier), and also provides resource representation like JSON and a set of HTTP method.

What are the advantages of API testing?

Advantages of API testing are:

Test for core functionality: API testing provides access to the application without the user interface. The core functionality of the application will be tested before the GUI tests. This will help to detect the minor issue which can become bigger during the GUI testing.
Time effective: API testing is less time consuming than GUI testing. Particularly, API test requires less code so it can provide better and faster test coverage compare to GUI test automation. This will reduce the cost for the testing project.
Language Independent: In API testing data is exchange using XML or JSON. These transfer mode are completely language-independent, which allows users to select any code language when adopting automation test service for the project.
Easy Integration with GUI: API tests provide highly integrable tests which is useful to perform functional GUI tests after GUI tests. Simple integration would allow new user accounts to be created within the application before GUI started.

What are the components of an HTTP request?

An HTTP request have five components. These are:

  1. Action showing HTTP method like GET, PUT, POST, DELETE.
  2. Uniform Resource Identifier (URI): URI is the identifier for the resource on the server.
  3. HTTP version: Indicate the HTTP version like- HTTP V1.1.
  4. Request Header: Request Header carries metadata for the HTTP request message. Metadata could be a client type, format supported by the client, format of a message body, cache setting etc.
  5. Request Body: Resource body indicates message content or resource representation.

What are the principles of an API test design?

Here, are the seven principles of API test design.

Exhaustive Testing: Exhaustive testing is not possible. Instead we need optimal amount of testing which is based on the risk assessment of the application.
Defect Clustering: Defect Clustering states that a small number of modules contain the most of the defect detected. Approximately 80% of the defect found in 20% of the modules. By experience we can identify such risky modules. But this approach has its own problems. If the same tests are repeated over and over again, eventually the same test case will no longer find new bugs.
Pesticide Paradox: Testers cannot depend on existing technique. They must have to look continually to improve the existing method to make testing more effective. But even all these hard work in testing we can never claim our product is bug free. To overcome this, test cases need to be regularly reviewed and revised add new and different test cases to help find more defects.
Testing shows presence of defects: Testing principle states that- testing talks about the presence of defects not about the absence of defect. Software testing reduces the probability of undiscovered defects remaining in the software but even if no defects found, it is not a proof of correctness.
But if we work hard, taking all precautions and make our software products 99% bug free. The software does not meet the needs and requirements of the client.
Absence of error -fallacy: This can be possible the software which is 99% bug free is still unusable. The case can be if the system is tested for the wrong requirement. Software testing is not finding the defects but also to check that software addresses the business needs. The absence of error is fallacy i.e. finding and fixing defects does not help if the system build is unusable and doesn’t fulfill the user’s needs and requirements.
Early Testing: Testing should start as soon as possible in the software development lifecycle. So that defects in the requirement or design phase captured in the early stages. It is cheaper to fix defect in the early stages of testing. We should start finding the bug at the moment the requirements are defined.
Testing is context dependent: Testing is context dependent that we test an e-commerce site will be different from the way we test the commercial. All the developed software’s are not identical. We will use different methodology; techniques and type of testing depend on the application type.

What are the types of bug that can be found during API testing?

API testing helps us to find many types of bugs which are:

  • Stress
  • Security
  • Duplicate or missing functionality
  • Reliability
  • Unused flags
  • Performance
  • Incompatible error handling
  • Multi-threaded issue
  • Improper errors

What are the protocols used in API Testing?

Protocols used in API testing are:

  • HTTP
  • REST
  • SOAP
  • JMS
  • UDDI

What is Resource in REST?

REST architecture treats any content as resource, which can be text files, HTML pages, images, videos or dynamic business information. REST server gives the functionality to access the resources and modifies them. We can identify the each resources by URIs/ global IDs.