MainMenu

Home Java Overview Maven Tutorials

Wednesday, 31 March 2021

API Testing Interview Questions

API Testing Interview Questions







What are Web Services?

A web Service can be defined by the following ways :-

1). Is a client server application or application component for communication.
2). Method of communication between two devices over network.
3). Is a software system for interoperable machine to machine communication.
4). Is a collection of standards or protocols for exchanging information between two devices of application.

What all challenges are included under API Testing?

API Documentation
Access to DB
Authorizarion Overhead

What is the difference between PUT and POST methods ?

Post :- Creating a new object on the server
Put :- Update the object in server with new table

What are Commonly used HTTP methods?


GET :- It enables you to retrieve data from a server
POST :- It enables you to add data to an existing file or resource in a server
PUT :- It lets you replace an existing file or resource in a server
Delete :- It lets you delete data from a server

List out few Authentication Technique used in API's?


Session/Cookie based Authentication
Basic Authentication
Digest Authentication
OAuth

What is Rest API?


REST stands for Representational State Transfer. It is set of functions helping developers in performing requests and receive responses. Interaction is made through HTTP protocol in REST API.

What exactly needs to verify in API testing?

In API testing, we send a request to API with the known data and then analysis the response.
1). We will verify the accuracy of the data.
2). Will see the HTTP status code.
3). We will see the response time.
4). Error codes in case API returns any errors.
5). Authorization would be check.
6). Non functional testing such as performance testing, security testing.

What are path parameters and Query parameters for below API Request URL

/ for path parameter
? is for Query parameter
for example http://way2testing.com/tutorialorder/1122369?location=GHN

so here /1122369 is path parameter
and ? location is Query parameter also in In General Query Parameter is constructed at the end of URL.

Whar are the core componenets of a HTTP request?

HTTP Request methods like PUT, POST, Delete.
Base Uniform Resource identifier (URI)
Resources and Parameters
Request Header, which carries metadata(a key-value pairs) for the HTTP Request message.
Request Body, which indicates the message content or resource representation.

What could be the HTTP method for below API Scenario? Answer if it is GET or POST.

Scenario :- An API which has Endpoint, Parameter, Headers, cookies and Payload.
Answer :- It is a POST request because it have Payload

What are the differences between API Testing and UI testing?

UI(User Interface) testing means the testing of the graphical user interface. The focus of UI testing is on the look and feel of the application. In user interface testing the main focus is on how user can interact with app elements such as images, fonts, layout etc. are checked.
API testing allows the communication between two software systems. API testing works on backend also known as backend testing.

What protocols is used by the RESTFUL web services?

RESTFUL web services uses the HTTP protocol. They use the HTTP Protocol as a medium of communication between the client and the server.

What are Soap webservices?

SOAP stands for Simple Object Access Protocol. It is an XML based messaging protocol. It helps in exchanging information among computers.

How do we Represent A resource in REST

Using HTTP methods

Can you use POST request instead of PUT to create a resource?

Yes, we can, because POST is Super set of all other HTTP methods except GET.

What do you understand by payload in restful Web Services?

Payload/Body is the secured input data which is sent to API to process the request. Payload is generally represented in JSON format in Rest API's.

What is Rest Assured.

It is Java Library which can automate REST API's.

How would we define API details in Rest Assured Automation?

we shall define all the request details and send it to server in GIVEN, WHEN & THEN methods.

What is Json serialization & Deserialization in Rest Assured.

Serialization in Rest Assured context is a process of converting a Java Object into Request body(payload).

Rest Assured also supports deserialization by converting Response body back to java Object.

List out few common Json Parsing Techniques used in Rest Assured Automation?

Json Path Deserialization of Json using POJO classes.

How would you send attachments to API using Rest Assured Test?

Using MultiPart Method.

Different Status Code & their description :-

200 OK The request was successfully completed

201 Created A new Resources was successfully created.

400 Bad Request The request was invalid

401 unauthorized The request did not include an authentication token or the authentication token was expired

403 forbidden The client did not have permission to access the requested resource

404 Not Found The requested resource was not found

405 Method not allowed The HTTP methods in the request was not supported by the resource.

409 Conflict The request could not be completed due to a conflict.

500 Internal server Error The request was not completed due to an internal error on server side.

503 Service Unavailable The server was unavailable.

No comments:

Post a Comment