All IT Courses 50% Off
QA Tutorials

API Testing

API stands for Application Programming Interface which mentions how one component should interact with other. It consists of set of routines, protocols and tools for building the software applications.

What is API Testing?

The API testing is performed for mainly system which has the collection of programming interfaces. When testing we consider some of the below aspects: 

  • By exploring boundary conditions and also making sure that the test harness which has various parameters of the API calls in ways that verify functionalities and failures.
  • Generating very large value added parameter combinations to verify the calls with two or more parameters.
  • Verify the behaviour of the API which considers the external environment conditions like as files, peripheral devices and so forth.

Types of output of an API:

An output of an API:

  1. Any type of data
  2. Status(pass or Fail)
  3. Call another API function

For example:

  • Any type of data

There will be an API function which should add two integer numbers

Long add (int a, int b)

The numbers that have been given as input parameters. The output should be a summation of two integer numbers. This output needs a verification with an expected outcome.

The function has to be called as: 

add (1234, 5656)

  • Status (say pass/fail)

Consider the below API functions

  1. Lock()
  2. Unlock()
  3. delete()

They actually return value such as true (in case of success) or false(in case of error) as an output. 

  • Call another API function

A more accurate Test suite is going to be a call to the functions in any scripts and should be later checked for the changes either within the database or could also be application GUI.

Test cases for an API testing:

Test cases for an API are based on:

  1. Return value based on the input condition: it is relatively easy to test, as input which can be explained and results can be authenticated.
  2. Doesn’t return anything: When there is no return value, a behaviour of API system has to be checked.
  3. Trigger some other API/event/interrupt: if an output of an API triggers some event or interrupt then those events and interrupt listeners will be tracked.
  4. Update data structure: Updating data structure will have some outcome or either system will be authenticated.
  5. Modify certain resources: If API call changes some resources, then it will be validated by accessing respective resources.

API testing Approach:

An API testing approach is a defined strategy or a method that the QA team will perform in order to conduct the API testing after the build will be ready. This testing does not include the source code. The API testing approach helps to understand the functionalities, testing technique, input parameters and therefore execution of test cases.

Challenges in API testing:

Challenges faced by API testing are:

  • Main challenges in web API testing are 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 also verifying the output in a different system is little difficult specially for testers
  • Exception handling functions need to be tested
  • coding knowledge is necessary for testers.
Facebook Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Check Also
Back to top button

Get Python Course
worth 499$ for FREE!

Offer valid for 1st 20 seats only, Hurry up!!

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

H2kinfosys Blog will use the information you provide on this form to be in touch with you and to provide updates and marketing.