Points:
What is API?
What is API Testing?
How to perform API Testing?
What is the difference between API testing and Unit Testing?
Here I am not focusing on any of the API testing related tool but I want to explain briefly about API testing, for this first we have to understand what is API testing.
What is API?
Many applications provide application programming interfaces (APIs) to allow code-level access to the functionality. These APIs, like any other interface into the product, need to be tested before released to the end-users.
API is a source code interface that services provides to support requests made by system or other applications.
What is API Testing?
API testing is mostly used for the system which has collection of API that needs to be tested.
GUI is rarely involved in API Testing and hence setting initial environment become complex. 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. Mostly the output of API is some data or status. You can check that status in the log file. In our projects we used the “JCAPS” and hence we can easily see the logs on emanager screen used in JCAPS.
In API testing, scope is not limited to any specific unit, but it normally cover complete system and hence it is considered as a type of “Black Box Testing”. Some people still assumes that API testing is the part of White Box Testing. But according to my opinion, this assumption is wrong as even though we used tools or do some coding, it doesn’t mean that we are doing White box testing. We can say it as Automation used for Black Box Testing method.
The most commonly used open source tool for API testing are
Ex: Webinject, Junit, XMLUNIT, HttpUnit, ANT etc.,
How to perform API Testing?
If organization decides to perform the API testing in the project, then it is the complete responsibility of testing team.
1. Before doing anything, it is very important to understand the ‘full’ functionality of the system, as it will be used by the end user (in this case, another program).
2. Design the ‘scenarios’ that the API will be used for, which typically involve interactions between several different modules within the application. 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.
3. Do necessary coding needed for the particular test case/scenarios to be covered.
4. Execute it according to the priorities which need to be decided while designing the test cases/scenarios.
What is the difference between API testing and Unit Testing?
Unit testing is the activity that is owned by the development team; 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 typically an activity owned by the QA team. API tests are often run after the build has been created, and it is common that the authors of the tests do not have access to the source code; they are essentially creating black box tests against an API rather than the traditional GUI.
Unit tests are typically designed by the developers to verify the functionality of each unit and there scope is limited to the unit under test. On the other hand, API tests are designed by the Tester, and the scope of API testing always considers the system-level interactions of the various units.
API is mostly black box testing where as unit testing is essentially white box testing.
Thursday, May 22, 2008
Subscribe to:
Posts (Atom)