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.
What is API Testing?
API testing is mostly used for the system
which has collection of API that needs to be tested. The system could be
system software, application software or libraries.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.
Test Cases for API Testing:
The test cases on API testing are based on the output.
•Return value based on input condition
Relatively simple to test as input can be defined and results can
be validated. Example: It is very easy to write test cases for int add(int a,
int b) kind of API. You can pass different combinations of int a and int b and
can validate these against known results.
•Does not return anything
Behavior of API on the system to be checked when there is no
return value.
Example: A test case to
delete(ListElement) function will probably require to validate
size of the list or absence of list element in the list.
•Trigger some other API/event/interrupt
The output of an API if triggers some event or raises some
interrupt, then those events and interrupt listeners should be tracked. The
test suite should call appropriate API and declarations should be on
the interrupts and listener.
•Update data structure
This category is also similar to the API category which does
not return anything. Updating data structure will have some effect on
the system and that should be validated.
•Modify certain resources
If API call is modifies some resources, for example makes update
on some database, changes registry, kills some processes etc, then it should be
validated by accessing the respective resources.
API Testing vs. Unit Testing: What’s the difference?
1. API testing is not Unit testing.
Unit testing is owned by development team and API by QE team.API is mostly black
box testing where as unit testing is essentially white box testing.
2. Both API-testing and unit-testing target the code-level , hence similar tools can be used for both activities. There are several open source tools
available for API testing and a few of them are Webinject, Junit,
XMLUNIT, HttpUnit, ANT etc.
3. API testing process involves testing the methods of .NET, JAVA,
J2EE APIs for any valid, invalid, and inappropriate inputs, and also testing
the APIs on Application servers.
4. Unit testing activity is owned by the
development team; and the developers are expected to build Unit
tests for each of their code modules (these
are typically classes, functions, stored
procedures, or some other ‘atomic’ unit of code), and to ensure that each
module passes its unit tests before the code
is included in a build. API testing, on the other hand, is
owned by the QE team, a staff other than the author of the code. API tests are
often run after the build is ready, and it
is common that the authors of the tests do not have access to the source code;
they essentially create black box tests against an API rather than the
traditional GUI.
5. Another key difference between API
and Unit testing lies in the Test Case design. Unit tests are
typically designed to verify that each unit in isolation performs as it should.
The scope of unit testing often does not consider the
system-level interactions of the various units. Whereas, API testing,
are designed to consider the ‘full’ functionality of the system,
as it will be used by the end users. This means that API tests must be far more extensive than unit tests, and take intoconsideration the sorts of ‘scenarios’ that the API will be used for, which typically involveinteractions between
several different modules within the application.
API Testing Approach
An approach to test the Product that contains an API.
Step I:
Understand that API Testing is a testing
activity that requires some coding and is usually beyond the scope of what developers
are expected to do. Testing team should own this activity.
Step II:
Traditional testing techniques such as equivalence classes and
boundary analysis are also applicable to API
Testing, so even if you are not too comfortable with coding, you can still design
good API tests.
Step III:
It is almost impossible to test all possible
scenarios that are possible to use with your API. Hence, focus on the
most likely scenarios, and also apply techniques like Soap Opera Testing and Forced Error
Testing using different data types and size to maximize the test coverage. Main
Challenges of API Testing can be divided into following categories.
• Parameter Selection
• Parameter combination
• Call sequencing
API Framework
The framework is more or less
self-explanatory. The purpose of the config file is to hold all the configurable components
and their values for a particular test
run. As a follow through, the automated test cases should be
represented in a ‘parse-able’ format in the config file. The script should be highly ‘configurable’. In the case of API Testing, it is not necessary to test every API in
every test run ( the number of API’s that are tested will
lessen as testing progresses). Hence the config file should have sections which detail which all API’s are “activated” for
the particular run. Based on this, the test cases should be picked up.
Since inserting the automation test case
parameters into config file can be a tedious activity, it
should be designed in such a way that the test case can be left static with a
mechanism of ‘activating’ and ‘deactivating’ them.
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).
Source: www.scribd.com/doc/9808382/Introduction-to-API-Testing
API testing is checking Application Programming Interface of a Software System.
ReplyDeleteIn order to check API , it needs to be called from the calling software . Necessary test environment, database, server, application setup needs to be prepared before doing API Testing.
API Testing is focused on the functionality of the software’s business logic and it is entirely different from GUI testing. It mainly concentrates on the business logic layer of the software architecture. This testing won’t concentrate on the look and feel of an application
You are right.
DeleteAPI Testing environment is very complex as it doesn’t involve user interface. Database and server should be configured as per the application requirements. API Function should be called to check whether that API is working or not.
ReplyDeleteAgree.
DeleteThis is very useful post for me and it helps me a lot. Thank you so much for this and have a great time..Hotels in Kumbakonam,Kumbakonam Hotels
ReplyDeleteThanks for this new information. I don't know about this API Testing. So really useful for me to understand testing techniques. software testing training in Bangalore
ReplyDeleteGreat article. keep trying to share your thought and content with us by your blog. looking nice content on your blog.Website Redesigning Services
ReplyDeleteThank you very much for sharing. You always try to sharing such a good information with us.Mobile Responsive Website Design
ReplyDeleteYour blog is an interesting for reading. Thank you for this useful information !!Mobile App Development Company
ReplyDeleteNice post and gives informative information.Web Development Company in Noida
ReplyDeleteNice post keep sharing!!SMO Services
ReplyDeleteThese are very helpful tips, Thanks for sharing such a good information with us.Content Writing Company In Noida
ReplyDeleteI read your article. Very Nice.Website Redesigning Services
ReplyDeleteI like to read this post because I met so many new facts about it actually. Great Tips !! Digital Marketing Services In Noida
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteAppreciate your efforts for writing that simple yet very effective article on API & API Testing
ReplyDeleteIt's Really A Great Post.
ReplyDeleteBest IT Training in Bangalore
Thank you very much for sharing. You always try to sharing such a good information with us.iPhone Apps Development Company India
ReplyDeleteUseful information! Wordpress Web Development Company In India
ReplyDeleteUseful information. Keep sharing!!Best Digital Marketing Agency in Delhi NCR
ReplyDeleteGreat article. keep trying to share your thought and content with us by your blog. looking nice content on your blog.SEO Company
ReplyDeleteAwesome, This post is very helpful, thanks for sharing.
ReplyDeleteSoftware Testing Training in Gurgaon
The information on this blog is very useful and very interesting. If someone needs to know about the just click Android Application Development in Bangalore | Android App Development Services Bangalore
ReplyDeleteHelpful to me. thank you for sharing. I am a regular reader of your blog.SEO Company
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteIt’s an Awesome post! This is the very helpful post for the developer.
ReplyDeleteThanks for sharing
software applications frisco
Nice article it's really very informative for me thanks.
ReplyDeleteEnterprise Mobility Software Solutions
Nice artiicle thankx for sharing Web Development Services in India
ReplyDeleteNice artiicle thankx for sharing SEO Services in India
ReplyDeleteWe are one of the most trusted Android Mobile App Developmentand IOS Application Development to meet your business complex requirement through offshore world.
ReplyDeleteDo you have project and want to discuss with us ? We can assist you in Web Application Development, Mobile App development, Games Development & Emerging Technology.
For More information https://www.theunpluggedweb.com
Hi Wow what a article i really enjoyed reading this i will come again to read, And you are looking for Hosting Services in india Please visit us We are Best Hosting Service Provider Thanks
ReplyDeleteBulk sms is a most fastest service in india for promote your Business. these service applications follow a particular channel and bandwidth limitation in delivering the messages to multiple users at a single time, It sends instant SMS alerts to the bulk SMS provider via delivery reports per message send to the targeted customer.
ReplyDeletehttp://truebulksms.com./bulk-sms.html
Great article Thankx for sharing Digital Marketing Services In India
ReplyDeleteNicely explained in simple terms.. Good job..!
ReplyDeletesoftware applications frisco
Best Engineering Colleges in Delhi
ReplyDeleteBest Engineering Colleges in Gurgaon
Best Engineering Colleges in Noida
Best Engineering Colleges in Pune
Best Engineering Colleges in Bangalore
Best Engineering Colleges in Chennai
Best Engineering Colleges in Hyderabad
ReplyDeleteThank you for giving the information and it is useful for me. training with placement company in Hyderabad
ReplyDeleteThank you so much for posting this. I really appreciate your work. Keep it up. Great work!
best courier service in India
Thanks for sharing it
ReplyDeleteWeb Promotion
nice post best devops training in chennai
ReplyDeletedevops training in chennai
best hadoop training in chennai
best hadoop training in omr
hadoop training in sholinganallur
best java training in chennai
best python training in chennai
thanks for sharing this information
ReplyDeletedata science training in bangalore
data science classroom training in bangalore
best training institute for data science in bangalore
best data science training institute in bangalore
data science with python training in bangalore
best data science training in bangalore
tableau training in bangalore
best tableau training institutes in bangalore
tableau classroom training in bangalore
good information.Today's Telugu news updates provide the updates of the films news. it gives the information about the upcoming films with the latest updates. Telugu news portal Brings the Breaking & Latest current Telugu news.
ReplyDeleteapi and their implementation is very tricky. well apart of this if you need any social media services then don`t forgot to contact us.
ReplyDeleteToday's Telugu news updates provide the updates of the films news. it gives the information about the upcoming films with the latest updates. Telugu news portal Brings the Breaking & Latest current Telugu news
ReplyDeleteNice Post.
ReplyDeleteapp development companies
app development company
app development companies
Thanks for Sharing Information.
ReplyDeleteWith Eventify, an event networking app, event networking and attendee interactions become more systematic than ever. Users are connected on the basis of mutually common interests.
ReplyDeletehttps://eventify.io/event-networking/
Buy indoor plants online near dwarka, new delhi - Birthright offers indoor plants for home online in India. At our online nursery, We have a team of talented brand shapers who have the capability, passion and knowledge to deal with clients.
ReplyDeleteAs a Graphic Design Services In India, We have a team of talented and Creative Graphic Designers to Create Custom Graphics.
Get contact details and address of Renovation Services, Renovation Works firms and a home renovation services is Negotiable.
Use the Blink Monitor App for Android to check in on what's happening at home from anywhere at any time. The app connects your home to your phone in HD video
Getlisting Provides Complete Solution If You Facing The PlentyOfFish (POF). Can't log in? Issues in United States. If your file is being reviewed for some reason, such as being reported by another Plenty of Fish user, your account might be temporarily suspended while the company investigates.
Your blog is interesting for reading. Thank you for sharing useful information Mobile App Development Company
ReplyDeleteemedstore
Really its great to see this kind of useful blog. Thanks for sharing this blog with us.
ReplyDeleteGroupon Mobile App The App Ideas