{"id":1026,"date":"2021-07-31T11:50:03","date_gmt":"2021-07-31T11:50:03","guid":{"rendered":"https:\/\/rahulshettyacademy.com\/blog\/?p=1026"},"modified":"2021-11-30T18:54:28","modified_gmt":"2021-11-30T18:54:28","slug":"top-30-api-testing-interview-questions-and-answers","status":"publish","type":"post","link":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/2021\/07\/31\/top-30-api-testing-interview-questions-and-answers\/","title":{"rendered":"Top 30 API Testing Interview Questions and Answers &#8211; Part 1"},"content":{"rendered":"<h3 align=\"left\" id=\"t-1627731085017\">1. What is an API?<\/h3>\n<p align=\"left\"><em><strong>API (Application Programming Interface) <\/strong><\/em>is a software intermediary that enables two applications to communicate with each other. HTTP-based API is often called a Web API since they are used to access Web Applications which are deployed to Servers accessible over the Internet or network. Applications that are accessed via HTTP APIs are often called Web Services.<\/p>\n<p align=\"left\">Mobile Applications often use Web Services and REST APIs to communicate with servers to implement their functionality. The Mobile Application processes the message returned from the Web Service and displays it to the User in the application GUI. So again, the user is unaware that HTTP requests are being made or of the format of the requests and responses.<\/p>\n<p align=\"left\">___________________________________________________________________________<\/p>\n<h3 align=\"left\" id=\"t-1627731085018\">2. Define &nbsp;API TESTING with its types ,examples and some common advantages?<\/h3>\n<p align=\"left\"><b>API Testing<\/b>&#8211; It is a kind of software testing to determines and check if the developed APIs meet expectations regarding the functionality, reliability, performance, and security of the application or not<\/p>\n<p align=\"left\"><strong>Common protocols that are testing in API testing are<\/strong> -HTTP, JMS, REST, SOAP, UDDI<\/p>\n<p align=\"left\"><b>Types-<\/b>Validation Testing, Functional Testing, UI testing, Load testing, Runtime\/ Error Detection, Security testing, Penetration testing, Fuzz testin, Interoperability testing<\/p>\n<p align=\"left\"><b>E<\/b><b>xample of API Testing:<\/b><\/p>\n<p align=\"left\"><b>Twitter<\/b>: The API for Twitter is usually in two categories, one for accessing data and the other for interacting with the Twitter search.<\/p>\n<p align=\"left\"><b>YouTube<\/b>: This API used for YouTube includes various functionalities including videos, live streaming, player, etc.<\/p>\n<p align=\"left\"><b>Google Maps AP<\/b>I: These are designed mainly for mobile and desktop use with the help of a flash interface and JavaScript.<\/p>\n<p align=\"left\"><b>Amazon Advertising API<\/b>: Amazon is known for their products and thus their advertising API accesses their product to discover their functionality and thus advertise accordingly<\/p>\n<p align=\"left\"><strong><b>ADVANTAGES<\/b> of API Testing:&nbsp;<\/strong><\/p>\n<p align=\"left\"><strong><\/strong><b>Compatibility and easy integration with GUI<\/b>: Simple integration would allow new user accounts to be created within the application before a GUI test started.<\/p>\n<p align=\"left\"><b>Language-Independent<\/b>: 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.<\/p>\n<p align=\"left\"><b>Time Effective<\/b>: 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.<\/p>\n<p align=\"left\"><b>Test for Core Functionality<\/b>: API testing provides the ability to 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 helps in detecting the minor issues which can become bigger during the GUI testing<\/p>\n<p align=\"left\">______________________________________________________________________________<\/p>\n<h3 align=\"left\" id=\"t-1627731085019\">3. What are the main differences between API and Web Service?<\/h3>\n<p align=\"left\"><strong>Main differences are given below:<\/strong>a) All web services are APIs but not all APIs are web services.<\/p>\n<p align=\"left\">b) 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.<\/p>\n<p align=\"left\">c) A web service always needs a network to operate while APIs don\u2019t need a network for operation.<\/p>\n<p align=\"left\">d) Web services might not contain all the specifications and cannot perform all the tasks that APIs would perform.<\/p>\n<p align=\"left\">______________________________________________________________________________<\/p>\n<h3 align=\"left\" id=\"t-1627731085020\">4. What are the differences between API Testing and UI Testing?<\/h3>\n<p align=\"left\">API enables the communication between two separate software systems. A software system implementing an API contains functions or subroutines that can be executed by another software system.<\/p>\n<p align=\"left\">On the other hand, UI ( User Interface) testing refers to testing graphical interface such as how users interact with the applications, testing application elements like fonts, images, layouts, etc. UI testing basically focuses on the look and feel of an application.______________________________________________________________________________<\/p>\n<h3 align=\"left\" id=\"t-1627731085021\">5. &nbsp;What are the principles of an API test design?<\/h3>\n<p align=\"left\">Basically, there are five most important principles of an API test design:<\/p>\n<p align=\"left\"><b>Setup<\/b>: Create objects, start services, initialize data, etc<\/p>\n<p align=\"left\"><b>Execution:<\/b> Steps to apply API or the scenario, including logging<\/p>\n<p align=\"left\"><b>Verification<\/b>: Oracles to evaluate the result of the execution<\/p>\n<p align=\"left\"><b>Reporting<\/b>: Pass, failed or blocked<\/p>\n<p align=\"left\"><b>Clean up<\/b>: Pre-test state<\/p>\n<p align=\"left\">______________________________________________________________________________<\/p>\n<h3 align=\"left\" id=\"t-1627731085022\">6. &nbsp;What is the procedure to perform API testing?<\/h3>\n<p align=\"left\">a) Create the suite to add the API test case<\/p>\n<p align=\"left\">b) Create the test development mode<\/p>\n<p align=\"left\">c) Demand the development of test cases for the required API methods<\/p>\n<p align=\"left\">d) Configure the control parameters of the application and then test conditions<\/p>\n<p align=\"left\">e) Configure method validation<\/p>\n<p align=\"left\">f) Arrange all API test cases<\/p>\n<p align=\"left\">g) Execute the API test<\/p>\n<p align=\"left\">h) Check test reports<\/p>\n<p align=\"left\">______________________________________________________________________________<\/p>\n<h3 align=\"left\" id=\"t-1627731085023\">7. What must be checked when performing API testing?<\/h3>\n<p align=\"left\">a) Accuracy of data<\/p>\n<p align=\"left\">b) Non-functional testing like performance and security testing<\/p>\n<p align=\"left\">c) Implementation of response timeout<\/p>\n<p align=\"left\">d) Schema validation<\/p>\n<p align=\"left\">f) HTTP status codes<\/p>\n<p align=\"left\">g) Data type, validations, order, and completeness<\/p>\n<p align=\"left\">h) Authorization checks<\/p>\n<p align=\"left\">I) Error codes in case API returns<\/p>\n<p align=\"left\">______________________________________________________________________________<\/p>\n<h3 align=\"left\" id=\"t-1627731085024\">8. What are tools could be used for API testing?<\/h3>\n<p align=\"left\">A few common tools are Katalon Studio, Postman, SoapUi Pro, Apigee, automated API testing using REST Assured and CURL etc.<\/p>\n<p align=\"left\">______________________________________________________________________________<\/p>\n<h3 align=\"left\" id=\"t-1627731085025\">9. What are the types of Bugs API testing can find?<\/h3>\n<p align=\"left\">a) Missing or duplicate functionality<\/p>\n<p align=\"left\">b) Stress<\/p>\n<p align=\"left\">c) Reliability<\/p>\n<p align=\"left\">d) Security<\/p>\n<p align=\"left\">e) Performance<\/p>\n<p align=\"left\">f) Unused flags<\/p>\n<p align=\"left\">g) Not implemented errors<\/p>\n<p align=\"left\">h) Inconsistent error handling<\/p>\n<p align=\"left\">I) Improper errors<\/p>\n<p align=\"left\">j) Fails to handle error conditions gracefully<\/p>\n<p align=\"left\">k) Multi-threading issues<\/p>\n<p align=\"left\">______________________________________________________________________________<\/p>\n<h3 align=\"left\" id=\"t-1627731085026\">10. Difference API and Unit Testing?<\/h3>\n<p align=\"left\">API is owned by QA team where as&nbsp; Unit testing is owned by the development team<\/p>\n<p align=\"left\">API is mostly black box testing where as Unit testing is white box testing<\/p>\n<p align=\"left\">Full functionality of the system is considered in API testing as it will be used by the end-user (external developers who will use your API )where as Unit testing is done to verify whether each unit in isolation performs as expected or not<\/p>\n<p align=\"left\">API test are often run after the build is ready and authors do not have access to the source code where as For each of their module, the developers are expected to build unit tests for each of their code modules and have to ensure that each module pass unit test before the code is included in a build.<\/p>\n<p align=\"left\">______________________________________________________________________________<\/p>\n<h3 align=\"left\" id=\"t-1627731085027\">11. What are the main challenges of API testing?<\/h3>\n<p align=\"left\">1) Parameter Selection<\/p>\n<p align=\"left\">2) Parameter Combination<\/p>\n<p align=\"left\">3) Call sequencing<\/p>\n<p align=\"left\">______________________________________________________________________________<\/p>\n<h3 align=\"left\" id=\"t-1627731085028\">12. What are API documentation templates that are commonly used?<\/h3>\n<p align=\"left\">There are several available API documentation templates help to make the entire process simple and straightforward.<\/p>\n<ul>\n<li align=\"left\">API blueprint<\/li>\n<li align=\"left\">RestDoc<\/li>\n<li align=\"left\">Web service API specification<\/li>\n<li align=\"left\">Swagger<\/li>\n<li align=\"left\">Miredot<\/li>\n<li align=\"left\">Slate<\/li>\n<li align=\"left\">FlatDoc<\/li>\n<\/ul>\n<p align=\"left\">______________________________________________________________________________<\/p>\n<h3 align=\"left\" id=\"t-1627731085029\">13. Explain what is an HTTP request?<\/h3>\n<p align=\"left\">Hypertext Transfer Protocol is a way of sending messages to software on another computer over the internet or over a network.<\/p>\n<p align=\"left\"><strong>An HTTP request is sent to a specific URL and consists of:<\/strong><\/p>\n<p align=\"left\">A) A VERB specifying the type of request e.g. GET, POST, PUT, DELETE<\/p>\n<p align=\"left\">B) A set of HTTP Headers. The headers specify information such as the type of browser, type of content in the message, and what type of response is accepted in return.<\/p>\n<p align=\"left\">C) A body, or payload in the request, representing the information sent to, or from, the Web Application. Not all HTTP messages can have payloads: POST and PUT can have payloads, GET and DELETE do not.<\/p>\n<p align=\"left\">______________________________________________________________________________<\/p>\n<h3 align=\"left\" id=\"t-1627731085030\">14. What is a URL?<\/h3>\n<p align=\"left\">URL is a Uniform Resource Locator and is the address we use to access websites and web applications. When working with APIs you will often see this referred to as a URI (Uniform Resource Identifier). We can think of a URI as the generic name for a URL. When we have to call an HTTP API we need the URL for the endpoint we want to call Example-<\/p>\n<p align=\"left\"><a href=\"https:\/\/www.thetravel.com\/10-best-indian-foods\/\" style=\"outline: none;\" target=\"_blank\" rel=\"noopener\">https:\/\/www.thetravel.com\/10-best-indian-foods\/<\/a><\/p>\n<p align=\"left\">This is the locator that says \u201cI want to call the \u201c10 best indian foods\u201d resource located at \u201cthetravel.com\u201d using the http protocol\u201d.<\/p>\n<p align=\"left\"><b>The above URL can be broken down into the form:<\/b><\/p>\n<p align=\"left\"><strong>scheme:\/\/host\/resource<\/strong><\/p>\n<p align=\"left\">\u2022 <strong>scheme<\/strong>-HTTP<\/p>\n<p align=\"left\">\u2022 <strong>host<\/strong>-thetravel.com<\/p>\n<p align=\"left\">\u2022 <strong>resource<\/strong>-10-best-indian-foods<\/p>\n<p align=\"left\"><b>A larger form for a URL is:<\/b><\/p>\n<p align=\"left\">scheme:\/\/host\/resource?query#fragment<\/p>\n<p align=\"left\">The query is a way of passing parameters in the URL to the endpoint e.g. Google uses query parameters to define the search term and the page:<\/p>\n<p align=\"left\"><a href=\"https:\/\/www.google.co.uk\/?q=test&amp;start=10#q=test\" style=\"outline: none;\" target=\"_blank\" rel=\"noopener\">https:\/\/www.google.co.uk\/?q=test&amp;start=10#q=test<\/a><\/p>\n<p align=\"left\">______________________________________________________________________________<\/p>\n<h3 align=\"left\" id=\"t-1627731085031\">15. Describe what are HTTP verbs?<\/h3>\n<p align=\"left\">A web browser will usually make <strong>GET requests<\/strong> and <strong>POST requests.<\/strong><\/p>\n<p align=\"left\"><strong>GET <\/strong>requests to ask to read information from the server e.g. clicking on a link.<\/p>\n<p align=\"left\"><strong>POST <\/strong>requests supply information to the server e.g. submitting a form.<\/p>\n<p align=\"left\"><strong>GET <\/strong>requests do not have a body, and just consist of the Verb, URL, and the Headers.<\/p>\n<p align=\"left\"><strong>POST <\/strong>requests can have a payload body.<\/p>\n<p align=\"left\"><em><strong>When working with a Web Application or HTTP API the typical HTTP Verbs used are:<\/strong><\/em><\/p>\n<p align=\"left\"><strong>GET<\/strong>, to read information.<\/p>\n<p align=\"left\"><strong>POST<\/strong>, to create information.<\/p>\n<p align=\"left\"><strong>PUT<\/strong>, to amend or create information.<\/p>\n<p align=\"left\"><strong>DELETE<\/strong>, to delete information.<\/p>\n<p align=\"left\">______________________________________________________________________________<\/p>\n<h5 style=\"text-align: center;\" id=\"t-1638298346441\"><em><span style=\"text-decoration: underline;\">Course Alert<\/span><\/em>If you are interested in learning API testing, check out some of the popular courses on Rest Assured, SoapUI, Python API testing below:<\/h5>\n<ul>\n<li><span><a href=\"https:\/\/courses.rahulshettyacademy.com\/p\/api-testing-restassured\" target=\"_blank\" style=\"outline: none;\" rel=\"noopener noreferrer\">REST API Testing(Automation) from scratch-Rest Assured java<\/a><\/span><\/li>\n<li><span><a href=\"https:\/\/courses.rahulshettyacademy.com\/p\/soapui-testing\" target=\"_blank\" style=\"outline: none;\" rel=\"noopener noreferrer\">WebServices \/ REST API Testing with SoapUI<\/a><\/span><\/li>\n<li><span><a href=\"https:\/\/courses.rahulshettyacademy.com\/p\/postman-tutorial\" target=\"_blank\" style=\"outline: none;\" rel=\"noopener noreferrer\">Learn Postman for API Automation Testing with Javascript<\/a><\/span><\/li>\n<li><span><a href=\"https:\/\/courses.rahulshettyacademy.com\/p\/python-sdet-backend-rest-api-automation-from-scratch\" target=\"_blank\" style=\"outline: none;\" rel=\"noopener noreferrer\">Python SDET-BackEnd \/Rest API Automation from Scratch<\/a><\/span><\/li>\n<\/ul>\n<h4><em><strong>A Quick Note<\/strong><\/em><\/h4>\n<p>Please remember all these courses comes with <strong>100% Lifetime acces<\/strong><strong>s<\/strong> and <strong>free updates for Lifetime!!<\/strong><\/p>\n<p>Please click on the link&nbsp;<strong><em><a href=\"https:\/\/rahulshettyacademy.com\/blog\/index.php\/2021\/07\/31\/top-30-api-testing-interview-questions-and-answers-part-2\/\" target=\"_blank\" style=\"outline: none;\" rel=\"noopener noreferrer\">Top 30 API Testing Interview Questions and Answers \u2013 Part 2<\/a><\/em><\/strong> to continue to part-2 series of this article.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. What is an API? API (Application Programming Interface) is a software intermediary that enables two applications to communicate with each other. HTTP-based API is often called a Web API since they are used to access Web Applications which are deployed to Servers accessible over the Internet or network. Applications that are accessed via HTTP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1027,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"class_list":["post-1026","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-interview-questions","post-wrapper","thrv_wrapper"],"_links":{"self":[{"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1026","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=1026"}],"version-history":[{"count":12,"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1026\/revisions"}],"predecessor-version":[{"id":1368,"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1026\/revisions\/1368"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/media\/1027"}],"wp:attachment":[{"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1026"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1026"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rahulshettyacademy.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}