API Testing

API Testing / Web Services Testing Tutorial

Introduction to API Testing

1) What is API?

> API Stands for Application Programming Interface API, it is a set of clearly defined methods of communication between various software components.

> It enables communication and data exchange between two separate Software Systems.

> Each time We use an app like Facebook, send an instant message, or check the weather on your phone, you’re using an API.

2) What is API Testing?

> API Testing is a type of Software Testing that involves testing application programming interfaces (APIs) directly and as part of integration testing to determine if they meet expectations for functionality, reliability, performance, and security.

> Since APIs lack a GUI, API testing is performed at the message layer.

> API Testing is entirely different from GUI Testing and mainly concentrates on the business logic layer of the Software System.

3) API Testing versus Web Services Testing

> Both are means of communications. The difference is that Web Service almost
always involves communication over network and HTTP is the most commonly used
protocol. Web service also uses SOAP, REST, and XML-RPC as a means of
communication.

> While an API can use any means of communication e.g. DLL files in C/C++, Jar
files/ RMI in java, Interrupts in Linux kernel API etc.

So, we can say that-

i. Web Service is an API wrapped in HTTP.
ii. All Web Services are API but APIs are not Web Services.
iii. Web Service might not perform all the operations that an API would perform.
iv. A Web Service needs a network while an API doesn’t need a network for its
operation.

4) Difference between API testing and Unit Testing

Unit Testing
i) Developers conduct it
ii) Separate functionality is tested
iii) Developer can access the source code
iv) UI testing is also involved
v) Only basic functionalities are tested
vi) Limited in scope

API Testing
i) Testers conduct it
ii) End to end functionality is tested
iii) Testers cannot access the source code
iv) Only API functions are tested
v) All functional issues are tested
vi) Broader in scope

5) Tools for API Testing

> Since API and Unit Testing both target source code, similar tools can be used for testing both.

i) Postman
ii) SoapUI
iii) Karate
iv) HttpMaster
v) Parasoft
vi) HP UFT
vii) Rest-assured
viii) Rest Console
ix) Pyresttest
x) API Fortress Etc…

6) Challenges of API Testing

> Main challenges in API testing is Parameter Combination, Parameter Selection, and Call Sequencing

> There is no GUI available to test the application which makes difficult to give input values

> Validating and Verifying the output in different system is little difficult for testers

> Exception handling function needs to be tested

> Coding knowledge is necessary for Testers
————————————————————-

Follow me on social media: