Ans: An API (Application Programming Interface) is a collection of software functions and procedures, called API calls, that can be executed by other software applications. Application developers code that links to existing APIs to make use of their functionality. This link is seamless and end-users of the application are generally unaware of using a separately developed API.
During testing, a test harness-an application that links the API and methodically exercises its functionality-is constructed to simulate the use of the API by end-user applications. The interesting problems for testers are:
1. Ensuring that the test harness varies parameters of the API calls in ways that verify functionality and expose failures. This includes assigning common parameter values as well as exploring boundary conditions.
2. Generating interesting parameter value combinations for calls with two or more parameters.
3. Determining the content under which an API call is made. This might include setting external environment conditions (files, peripheral devices, and so forth) and also internal stored data that affect the API.
4. Sequencing API calls to vary the order in which the functionality is exercised and to make the API produce useful results from successive calls.
Ans: REST represents REpresentational State Transfer; it is relatively new aspect of writing web api.
RESTFUL is referred for web services written by applying REST architectural concept are called RESTful services, it focuses on system resources and how state of resource should be transported over HTTP protocol to a different clients written in different language. In RESTFUL web service http methods like GET, POST, PUT and DELETE can be used to perform CRUD operations.
Ans: The architectural style for creating web api are
Ans: SOAPUI tool for SOAP WS and Firefox “poster” plugin for RESTFUL services.
Ans: HTTP methods supported by REST are:
Ans: No, you are not supposed to use POST or GET. GET operations should only have view rights.
Ans: Resources are identified by logical URLs; it is the key element of a RESTful design. Unlike, SOAP web services in REST, you view the product data as a resource and this resource should contain all the required information.
Ans:
AJAX | REST |
· In Ajax, the request are sent to the server by using XMLHttpRequest objects. The response is used by the JavaScript code to dynamically alter the current page
· Ajax is a set of technology; it is a technique of dynamically updating parts of UI without having to reload the page · Ajax eliminates the interaction between the customer and server asynchronously · REST requires the interaction between the customer and server |
· REST have a URL structure and a request/response pattern the revolve around the use of resources
· REST is a type of software architecture and a method for users to request data or information from servers · REST requires the interaction between the customer and server |
Ans: Some key characteristics of REST includes
Ans: The different integration styles includes
Ans: JAXB stands for java arch for xml binding.
Ans: “PUT”puts a file or resource at a particular URI and exactly at that URI. If there is already a file or resource at that URI, PUT changes that file or resource. If there is no resource or file there, PUT makes one
POST sends data to a particular URI and expects the resource at that URI to deal with the request. The web server at this point can decide what to do with the data in the context of specified resource
Ans: JSON and XML are the two markup language that can be used in restful web api
Ans: In document style web services, we can transport an XML message as part of SOAP request which is not possible in RPC style web service. Document style web service is most appropriate in some application where XML message behaves as document and content of that document can alter and intention of web service does not rely on the content of XML message.
Ans: Both JAX-WS and JAX-RS are libraries (APIs) for doing communication in various ways in Java. JAX-WS is a library that can be used to do SOAP communication in JAVA, and JAX-RS lets you do the REST communication in JAVA.
Ans: Testing tools for web services for REST APIs includes
Ans:
SOAP | REST |
· SOAP is a protocol through which two computer communicates by sharing XML document
· SOAP permits only XML |
· Rest is a service architecture and design for network-based software architectures
· REST supports many different data formats · REST is faster than SOAP |
API Testing and API Rest Interview Questions and answers:
Ans: API (Application Programming Interface) specifies how some software components should interact with other, in other words it’s a set of functions and procedures that allows the creation of applications which access the features or data of an application or operating system. Testing of these functions is known as API testing.
Ans: The tools used for various API testing are
Ans: The common tests performed on API’s
Ans: UI ( User Interface) refers to testing graphical interface such as how user interacts with the applications, testing application elements like fonts, images, layouts etc. UI testing basically focuses on look and feel of an application.
While, API enables communication between two separate software systems. A software system implementing an API contains functions or sub-routines that can be executed by another software system
Ans: SOAP-stands for Simple Object Access Control, and it is an XML based protocol for exchanging information between computers.
Ans: It is a set of functions to which the developers performs requests and receive responses. In REST API interaction is made via HTTP protocol
REST – stands for Representational State Transfer, it is quickly becoming defacto standard for API creation.
Ans:
API testing | UNIT testing |
· API is owned by QA team | · Unit testing is owned by development team |
· API is mostly black box testing | · Unit testing is white box testing |
· 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 ) | · Unit testing is done to verify whether each unit in isolation performs as expected or not |
· API test are often run after the build is ready and authors do not have access to the source code | · 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 |
Ans: To test the API’s you should follow the following steps
Ans: The key area to be considered when writing API documents are
Ans:
Popular tools used for API documentations are JavaDoc (for Java code ) Doxygen (for .Net code)
Ans: API framework is self-explanatory. Values for test run and for holding the configurable parts, config file is used. Automated test cases must represent in “ parse-table” format within config file. When testing API, it is not necessary to test each API so the config file have some section whose all API are activated for that specific run.
Ans: API Builder is a PLSQL program consists of four SQL files
Ans: TestApi is a library of utility and test APIs that enables testers and developers to create testing tools and automated tests for .NET and Win32 application. It provides a set of common test building blocks, types, data-structure and algorithms.
Ans: Input Injection: It is the act of simulating user input, in several ways you can simulate user input.
Ans: The main challenges in API testing is
Ans: Runscope is a web application that provides backend services and easy to use interface for testing APIs.
Ans: The principle for API test design are
Ans: The types of Bugs, API will find
Ans: While testing Unit and API testing, both target source code, if an API method is using code based on .NET then the tool which is supporting should have .NET
Automation tools for API testing can be used are
Ans: API testing steps
Ans:
Ans:
Ans:
Ans: REST uses different representations to define a resource like text, JSON, and XML.
XML and JSON are the most popular representations of resources.
Ans: RESTful web services make use of HTTP protocol as a medium of communication between client and server.
Ans: RESTful web services make use of HTTP protocol as a medium of communication between client and server. The client sends a message in the form of an HTTP Request.
In response, the server transmits the HTTP Response. This technique is called Messaging. These messages contain message data and metadata i.e. information about the message itself.
Ans: Each HTTP request includes five key elements.
Ans: Every HTTP response includes four key elements.
Ans: There are a few HTTP methods in REST which are more popular.
Ans: No, you shouldn’t use a PUT or POST method. Instead, apply the GET operation which has view-only rights.
Ans: PUT and POST operation are almost same. The only difference between the two is in the terms of the result generated by them.
PUT operation is idempotent while POST operation can give a different result.
Let’s take an example.
Q32. What Purpose Does The OPTIONS Method Serve For The RESTful Web Services?
Ans: This method lists down all the operations a web service supports. It makes read-only requests to the server.
Ans: URI stands for Uniform Resource Identifier. URI is the identifier for the resource in REST architecture.
The purpose of a URI is to locate a resource(s) on the server hosting the web service. A URI is of the following format
Q34. What Do You Understand By Payload In RESTFul Web Service?
Ans: Request body of every HTTP message includes request data called as Payload. This part of the message is of interest to the recipient.
We can say that we send the payload in POST method but not in <GET> and <DELTE> methods.
Ans: <GET> appends data to the service URL. But, its size shouldn’t exceed the maximum URL length. However, <POST> doesn’t have any such limit.
So, theoretically, a user can pass unlimited data as the payload to POST method. But, if we consider a real use case, then sending POST with large payload will consume more bandwidth. It’ll take more time and present performance challenges to your server. Hence, a user should take action accordingly.
Ans: Caching is a process of storing server response at the client end. It makes the server save significant time from serving the same resource again and again.
The server response holds information which leads a client to perform the caching. It helps the client to decide how long to archive the response or not to store it at all.
Ans: Following tools can help in testing the SOAP and RESTful web services.
Ans: In general, using REST based web service is preferred due to its simplicity, performance, scalability, and support for multiple data formats.
However, SOAP is favorable to use where service requires an advanced level of security and transactional reliability.
But you can read the following facts before opting for any of the styles.
Here are some of the advanced-level facts that you can consider as well.
Ans: There are many frameworks and libraries available that a developer can use to create RESTful web services in Java. For example, the JAX-RS library is a standard way to develop a REST web service.
Also, Jersey is another most popular implementations of JAX-RS which offers more than what the specs recommend. There are others like RESTEasy, RESTlet, and Apache CFX.
If you like Scala, then you should be using Play framework to develop RESTful web services.
Ans: There are a few HTTP methods in REST which are more popular.