QA Interview: Top 40: Most Frequently Asked API Testing Interview Questions

Other Useful Links:

      


1. What is API?

  • API stands for Application Programming Interface. 
  • API serves as a bridge between two software applications, allowing them to connect with one another.
  • API refers to a set of software functions that can be used by another program.
  • Google Maps API, Amazon Advertising API, Twitter API, and YouTube API are other examples.


2. How do APIs work?
  • An API's general workflow is to take a request, process it (which may include data validation, database interaction, and data processing), and then return the output to the source.
  • Because APIs are not exposed to the outside world, they provide an abstraction for internal business logic.

3. What is API Testing?
  • API testing is a sort of software testing in which APIs are directly tested.
  • It's part of integration testing to see if the API fits the application's requirements for functionality, stability, performance, and security.
  • Our main focus in API testing will be on the software architecture's business logic layer.
  • Any software system with various APIs can be subjected to API testing.

4. What are the advantages of API Testing?
  • Test for Core Functionality:
    • API testing allows you to access the application without having to use the user interface.
    • Before the GUI tests, the application's core and code-level functionality will be tested and reviewed.
    • This will aid in the detection of minor flaws that could become more serious during the GUI testing.
  • Time Effective:
    • Testing APIs takes far less time than testing functional GUIs.
    • In GUI testing, web items must be polled, which slows down the process.
    • API test automation, in particular, needs less code and hence provides better and faster test coverage than GUI test automation. As a result, the testing project will be less expensive.
  • Language-Independent:
    • Data is transmitted using XML or JSON during API testing. These transfer modalities are totally language-independent, allowing customers to use any programming language when using automated testing services.
  • Easy Integration with GUI:
    • API tests allow for highly integrable tests, which is especially beneficial if you wish to run functional GUI tests following API testing.
    • Simple integration, for example, would allow for the creation of new user accounts within the programme prior to the commencement of a GUI test.

5. What are the most commonly used tools for API testing?
  • PostMan is the most widely utilised tool on the market. This tool helps to create manual and automated test cases for testing the APIs in a well-designed manner.
  • Aside from that, there are several tools such as JMeter, Parasoft SOAtest, SoapUI, Apigee, API Fortress, JUnit, and so on.

6. What should be validated during API testing?
  • We'll double-check the data's accuracy.
  • Will see the HTTP status code.
  • We will see the response time.
  • Error codes if API returns any errors.
  • Authorization would be checked.
  • Non-Functional testing like performance testing, security testing.

7. What are the API testing protocols?
Protocols used in API testing are:
  • HTTP
  • REST
  • SOAP
  • JMS
  • UDDI

8. What components make up an HTTP request?

An HTTP request has five components. These are:
  • HTTP method like GET, PUT, POST, DELETE.
  • Uniform Resource Identifier (URI): URI is the identifier for the resource on the server.
  • HTTP version: Give the HTTP version, such as HTTP V1.1.
  • Request Header: The HTTP request message's metadata is carried in the Request Header. A client's type, supported formats, message content format, cache setting, and so on are all examples of metadata.
  • Request Body: The message body or resource representation is indicated by the resource body.

9. What is the HTTP protocol supported by REST?
  • GET: The GET method is used to request data from a given resource. It is saved in the browser history and is limited in length. GET requests should not be utilised when dealing with sensitive data.
  • POST:POST is a method of sending data to a server for the purpose of creating or updating resources. POST requests are never cached or bookmarked.
  • PUT: PUT updates the target resource's current representation with the request payload.
  • DELETE: DELETE removes the specified resource.
  • OPTIONS: The communication option for the target resources is described by the term OPTION.
  • HEAD: HEAD requests the same response as GET requests, but without the response body.


10. What are the major challenges faced during API testing?
  • Parameter Selection
  • Parameter Combination
  • Call sequencing
  • Output verification and validation
  • Providing input values, which is difficult because there is no GUI, is a huge challenge.

11. Why is API testing considered as the most suitable form for Automation testing?

API testing is now preferable over GUI testing because:
  • It effectively verifies all of the functional routes of the system under test.
  • It provides the most stable interface.
  • It's simpler to manage and gives immediate response.

12. List a few authentication techniques used in API testing.
  • Session / Cookies based Authentication
  • Basic Authentication
  • Digest Authentication
  • OAuth

13. State the common status code you encounter in API testing
  • 200 OK: Success
  • 201 Created: In the database, the value associated with the request has been created.
  • 204 No Content: This status code indicates that the request was received correctly, but that the server has no response to deliver to the client.
  • 400 Bad Request: A bad request has inappropriate syntax. If you supplied the improper parameters with the request URL or in the body of the request, this can happen.
  • 401 Authorized: When you are not authorised to access the server or have entered incorrect credentials, we may receive this status code.
  • 403 Forbidden: Because the client does not have access to the content and is therefore unauthorised, the server refuses to provide the requested resource.
  • 404 Not Found: A 404 response code indicates that the server was connected but was unable to locate the information requested.
  • 422 Unprocessable Entity: Due to semantic issues, the request could not be followed.
  • 500 Internal Server Error: A response code of 500 indicates that the server encountered an error while processing the request.
  • 501 Not Implemented: The server does not support the request method and cannot process it.
  • 502 Bad Gateway: In attempting to complete the request, the server received an incorrect answer from the upstream server it accessed.
  • 503 Service Unavailable: Due to temporary overloading or server maintenance, the server is currently unable to handle the request.
  • 504 Gateway Timeout: The server failed to receive a timely response from the upstream server specified by the URI while functioning as a gateway or proxy.

14. How do API testing and UI testing differ?
  • The testing of the graphical user interface is known as UI (User Interface) testing. The look and feel of the application is the focus of UI testing. The main focus of user interface testing is on how people interact with app features such as graphics, typefaces, and layout.
  • API testing allows two software systems to communicate with each other. API testing, often known as backend testing, is performed on the backend.

15. What is SOAP?
  • It's an XML-based protocol for data transfer between computers.

16. What is the REST API?
  • REST API is a set of functions that helps the developers perform requests when the response is received. In the REST API, interactions are made using the HTTP protocol. REST is defined as Representational state transfer. It is a useful standard for developing APIs.

17. What is the most popular way to represent a resource in REST?
  • To define a resource, REST uses several forms such as text, JSON, and XML.
  • The most prevalent resource representations are XML and JSON.

18. Can we create a resource using GET requests instead of PUT?
  • To build a resource, use the PUT or POST method.
  • The GET technique is solely for resource requests.

19. Which purpose does the OPTIONS method serve for the RESTful Web services?
  • The OPTIONS method returns a list of all the operations that a web service can perform.


20.What is Payload?
  • In the case of REST APIs, the most commonly used term is payload. It is the actual data delivered to the server in the API request in various formats such as JSON, XML, and so on.

Next: Top 40: Most Frequently Asked API Testing Interview Questions (21-40)


Greetings, reader! Your input is highly important to us. Please share your thoughts in the comments section below.


Contact:

Email:  piyushagrawal.automation@gmail.com

Follow on LinkedIn: Piyush Agrawal - LinkedIn

Follow on YouTube: Piyush Agrawal - Youtube

Happy to Help You !!

No comments:

Post a Comment