Understanding API Testing and REST APIs - Prof. Sharma, Schemes and Mind Maps of Mathematics

A comprehensive guide on api testing, focusing on rest apis. It explains what apis are, the difference between rest apis and soap apis, what to test in api testing, and the importance of api testing. The document also covers http methods, cookies, authentication, and api testing tools, with a detailed explanation using postman as an example. It is a valuable resource for developers, testers, and anyone interested in understanding the intricacies of api testing.

Typology: Schemes and Mind Maps

2023/2024

Uploaded on 02/27/2024

palash-doshi
palash-doshi 🇮🇳

2 documents

1 / 17

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Understanding API Testing and REST APIs - Prof. Sharma and more Schemes and Mind Maps Mathematics in PDF only on Docsity!

Table of Contents

  • What is API?
  • What is API Testing?
  • What is REST API?
  • Difference between REST API vs SOAP API.
  • What to Test in API Testing?
  • HTTP - Fundamentals
    • What is an Cookies?
    • What is Authentication?
  • HTTP Methods explained. - HTTP GET Method Explained - - HTTP POST Method Explained - - HTTP PUT Method Explained - - HTTP PATCH Method Explained - - HTTP DELETE & OPTIONS Method Explained - - HTTP HEAD/TRACE Method Explained -
  • How to Test an API ( API Testing)?
  • API Testing tools
  • How to do API Testing using Postman

Simple Examples is, Suppose you go to a restaurant. API is the messenger that takes your order(waiter) and tells the system(kitchen) what to do (to prepare food) and in return gives back the response you asked for (waiter returns with the ordered food). Source - Quora. https://www.quora.com/What-is-an-API Type of APIs :-

What is API Testing?

When we talk about API Testing, API testing is testing that APIs and its integration with the services. It is one of the most challenging type of testing, If we miss the certain cases in API Testing that can cause a very big problem in production after full integration and it will hard to debug in production environment.. In this definite guide, We are basically discussing about the REST API Testing.Where we need to test the REST APIs for the validation, error codes and load testing.

What is REST API?

As REST is an acronym for REpresentational State Transfer, statelessness is key. An API can be REST if it follows the below constraints. The REST architectural style describes six constraints. These constraints, put on the architecture, were initially communicated by Roy Fielding in his doctoral dissertation and defines the basis of RESTful-style.

**1. Uniform Interface

  1. Stateless
  2. Cacheable
  3. Client-Server
  4. Layered System
  5. Code on Demand Uniform Interface** The uniform interface constraint defines the interface between clients and servers. In other terms, First constraint of the REST API states that the Client and server has to communicate and agree to certain rules based on resources(they should communicate with same resource like json, xml, html , txt) and with proper encoding like UTF- 8 extra.

Difference between REST API vs SOAP API.

We have already discussed REST API , Lets now Learn what is SOAP API. SOAP (Simple Object Access Protocol) is a messaging protocol that allows programs that run on disparate operating systems or services like frontend or backend to communicate using Hypertext Transfer Protocol (HTTP) and its Extensible Markup Language (XML). SOAP uses WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. Enough of background lets come to topic…

What to Test in API Testing?

● Validate the keys with the Min. and Max range of APIs (e.g maximum and minimum length) ● Have a Testcase to do XML,JSON Schema validation. ● Keys verification. If we have JSON, XML apis we should verify it's that all the keys are coming. ● Verify that how the APIs error codes handled. Lets understand why API Testing is important…

Why you should perform API Testing?

● Many of the services that we use every day rely on hundreds of different interconnected APIs, if any one of them fails then the service will not work. ● Right now, Internet uses millions of APIs and they should be tested thoroughly. ● Developers make mistake and they create buggy APIs.. ● Validation of APIs is very important which are going live to production. Above image shows the architecture of an application and notice that API Testing is important part.. Now… Lets learn one more concept HTTP Methods

HTTP - Fundamentals

HTTP is an application layer protocol designed within the framework of the Internet protocol suite.

Digest Authentication - Authentication is performed by transmitting the password in an ENCRYPTED form.(With Some Salt etc) OAuth - Authentication protocol that allows you to approve one application interacting with another on your behalf without giving away your password. E.g OAuth 1, 2. More authentication are discussed here - https://scrolltest.com/2018/11/22/how-to-handle-authentications-with-postman/ In Client as Browser and Server as DB with the service running in PHP. We can create an HTTP request from browser by typing a URL. Just for more information, URL can be broken down into the further chunks like protocol, host , post and query params. More discussion is out of scope for URL Lets Understand what all HTTP methods are present

HTTP Methods explained.

HTTP GET Method Explained -

HTTP PATCH Method Explained -

HTTP DELETE & OPTIONS Method Explained -

HTTP HEAD/TRACE Method Explained -

Now we have a HTTP Methods knowledge lets understand what are Cookie and authentication.

How to Test an API ( API Testing)?

Before that take a look into the example api that can available freely. https://api.chucknorris.io/jokes/random Here Keys are cateroy, icon_url, id, url and value and they have corresponding values as String or number. API Testing can be done manually or using a Tools. It is always recommend to certain tools. Lets learn API Testing using our favorite tools..

Major features of postman