API Questions & Answers
API Questions & Answers
In simple words, API stands for Application Programming Interface. API acts as an
interface between two software applications and allows the two software
applications to communicate with each other. API is a collection of software
functions that can be executed by another software program.
API testing can be performed on any software system which contains multiple
APIs.
Unit testing
Functional testing
Load testing
Runtime/ Error Detection
Security testing
UI testing
What is API test environment?
In API testing environment, no GUI (Graphical User Interface) is available.
For API, the test environment is a rather sophisticated approach that configures
the server and database to match the requirement of the software application.
After the installation process is done, API will be verified for correct functioning.
Throughout the process, various parameters for the original environment are
established via API calls to examine the test result
Swagger
FlatDoc
RestDoc
API blueprint
Slate
Miredot
Web service API Specification.
What are the main challenges faced in API testing?
Some of the challenges we face while doing API testing are as follows
APIs:
What is Soap?
SOAP stands for Simple Object Access Protocol. It is an XML based messaging
protocol. It helps in exchanging information among computers.
What is Rest API?
REST stands for Representational State Transfer. It is a set of functions helping
developers in performing requests and receive responses. Interaction is made
through HTTP Protocol in REST API.
REST:
1. REST is a service architecture and design for network-based software
architecture
2. REST supports different data formats
3. REST supports caching
4. REST is faster than SOAP
5. REST client is just like a browser and uses standard methods An application has
to fit inside it
6. REST uses the HTTP headers to hold meta information
1. Verify whether the return value is based on the input condition. The response
of the APIs should be verified based on the request.
2. Verify whether the system is authenticating the outcome when the API is
updating any data structure
3. Verify whether the API triggers some other event or request another API
4. Verify the behavior of the API when there is no return value
What are the advantages of API Testing?
API Testing is time effective when compared to GUI Testing. API test
automation requires less code so it can provide faster and better test
coverage.
API Testing helps us to reduce the testing cost. With API Testing we can
find minor bugs before the GUI Testing. These minor bugs will become
bigger during GUI Testing. So finding those bugs in the API Testing will be
cost-effective to the Company.
API Testing is language independent.
API Testing is quite helpful in testing Core Functionality. We can test the
APIs without a user interface. In GUI Testing, we need to wait until the
application is available to test the core functionalities.
API Testing helps us to reduce the risks.
POST should be used when the client sends the page to the server and then the
server lets the client know where it put it. PUT should be used when the client
specifies the location of the page
Before testing an API, first we will see some building blocks of Postman Tool that
are essential for every Postman operation.
1. Requests
2. Collections
3. Environment
1. Requests:
A request is a combination of the URL, HTTP headers, Body or Payload. In the
postman tool, you can save your requests and use them in the future based on
your needs.
2. Collections:
Collections are a group of saved requests you can organize into folders. We can
call it as a repository to save our requests.
3. Environment:
Environments in Postman allow us to run requests and collections against
different data sets. We could have different environments for Dev, QA, UAT &
Production.
Example : https://reqres.n/users/id=2
In API document explain how to document each function? What are the
tools used for documentation?