API Testing
API Testing
API and API Testing Right tool for API Testing How API works ?
www.tothenew.com
What is API?
API stands for Application
Programming Interface.
API is an software to
software
interface, not a user
interface.
Implemented by writing
function
calls in the program.
What is API Testing?
API testing uses software to send
calls to the API and get the
output.
Request
Response
REST API
REST – stands for Representational State Transfer.
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 also allows computers to talk to each other over a network.
It involves using HTTP methods to send and receive messages, and does
not require a strict message definition, unlike Web services.
REST messages often take the form of XML, or JavaScript Object
Notation (JSON).
HTTP Methods
4 Commonly Used Methods:-
GET : - Provides a read only access to a resource.
POST :- Used to create a new resource.
PUT :- Used to update an existing resource or create a new resource.
DELETE :- Used to Remove a resource.
GET GET
REQUEST RESPONSE
POST POST
REQUEST RESPONSE
DELETE DELETE
REQUEST RESPONSE
REST API Inputs
Status : 200 OK
GET {
message: "Beam Detail fetched successfully"
data:
https://restful- {
booker.herokuapp.com/booking name : "name goes here"
eventStatus : "COMPLETED"
startTime : "10 Oct 2015
14:25:00"
viewCount : "2354"
likeCount : 88
disLikeCount : 99
commentCount : 5
duration : 1490
performerId : 10244
}
status: 1
}
POST Methods
Request Response
Status : 200 OK
POST
•{
•"status": 1,
Status : 200 OK
PUT
•{
•"status": 1,
Status : 200 OK
DELETE
{
message: "Beam Detail fetched successfully"
https://restful- data:
{
booker.herokuapp.com/booking name: "name goes here"
eventStatus: "COMPLETED"
startTime: "10 Oct 2015 14:25:00"
viewCount: "2354"
likeCount: 88
disLikeCount: 99
commentCount: 5
duration: 1490
performerId: 10244
}
status: 1
}
HTTP Response Codes
Some HTTP response codes, which are often used with REST:-
Time Effective
Language Independent
Test Core Functionality
Reduce Testing cost
Reduced Risks
Challenges of API Testing
Challenges of API Testing:-
Header Method