Introduction To API Testing
Introduction To API Testing
What is API?
An API (Application Programming Interface) is a collection of software functions and procedures,
called API calls, that can be executed by other software applications.
API testing is different from other testing types as GUI is rarely involved in API Testing. Even if GUI
is not involved in API testing, you still need to setup initial environment, invoke API with required
set of parameters and then finally analyze the result.
Setting initial environment become complex because GUI is not involved. In case of API, you need
to have some way to make sure that system is ready for testing.
This can be divided further in test environment setup and application setup. Things like database
should be configured, server should be started are related to test environment setup. On the other
hand object should be created before calling non static member of the class falls under application
specific setup.
Initial condition in API testing also involves creating conditions under which API will be called.
Probably, API can be called directly or it can be called because of some event or in response of
some exception.
Definitions:
Soap Opera Testing: Soap opera tests exaggerate and complicate scenarios in the way that television soap
operas exaggerate and complicate real life.
Forced Error Testing: Forced error testing is nothing but mutation testing. It is process of inducing error /
changes to the application to find how application is working. The forced-error test (FET) consists of negative
test cases that are designed to force a program into error conditions. A list of all error messages that the
program issues should be generated. The list is used as a baseline for developing test cases.
Software Functions and Procedures: Functions and procedures are the foundations of programming. They
provide the structure to organize the program into logical units that can manage the various activities needed
for a program.
Functions
There are two basic types of functions:
Built-in—these are built into the programming environment and do things such as opening and closing files,
printing, writing, and converting variables (e.g., text to numbers, singles to integers, etc.).
Application/user-specific—depending on what the program needs, you can build functions and procedures
using built-in functions and procedures and variables.
Procedures
Procedures are used to perform a series of tasks. They usually include other procedures and functions within
the program.
Procedures typically do not return a value, they are simply executed and return control to the calling
procedure or subroutine.
Procedures in Visual Basic are called "Subroutines," often "Sub" for short. In JavaScript, "Functions" are used
as procedures (they simply return no or null values to whatever called them).