An
application programming interface (API) is a set of routines, protocols, and
tools for building software applications. An API expresses a software component
in terms of its operations, inputs, outputs, and underlying types. An API
defines functionalities that are independent of their respective
implementations, which allows definitions and implementations to vary without
compromising each other. A good API makes it easier to develop a program by
providing all the building blocks.
API
Testing is entirely different from GUI Testing and mainly
concentrates on the business logic layer of the software architecture.
This testing won't concentrate on the look and feel of an application.
Instead
of using standard user inputs(keyboard) and outputs, in API Testing, you use
software to send calls to the API, get output, and note down the system's
response.
API
Testing requires an application to interact with API. In order to test an API,
you will need to
- Use Testing Tool to drive the API
- Write your own code to test the API
Test Cases for API Testing-
- Return value based on input condition: it is relatively easy to test, as input can be defined and results can be authenticated
- Does not return anything: When there is no return value, behavior of API on the system to be checked
- Trigger some other API/event/interrupt: If output of an API triggers some event or interrupt, then those events and interrupt listeners should be tracked
- Update data structure: Updating data structure will have some outcome or effect on the system, and that should be authenticated
- Modify certain resources: If API call modifies some resources then it should be validated by accessing respective resources
What to test for in API testing-
API
testing should cover atleast following testing methods apart from usual SDLC
process
- Discovery testing: The test group should manually execute the set of calls documented in the API like verifying that a specific resource exposed by the API can be listed, created and deleted as appropriate
- Usability testing: This testing verifies whether the API is functional and user-friendly. And does API integrates well with another platform as well
- Security testing: This testing includes what type of authentication is required and whether sensitive data is encrypted over HTTP or both
- Automated testing: API testing should culminate in the creation of a set of scripts or a tool that can be used to execute the API regularly
- Documentation: The test team has to make sure that the documentation is adequate and provides enough information to interact with the API. Documentation should be a part of the final deliverable
Challenges of API Testing-
Challenges
of API testing includes:
- 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
- Parameters selection and categorization is required to be known to the testers
- Exception handling function needs to be tested
- Coding knowledge is necessary for testers
Advantages of API Testing-
Putting more effort into API testing leads to a much healthier
final product. Ensuring that all data access (read and write) goes only through
the API significantly simplifies security and compliance testing and thereby
certification, since there is only one interface.
Ensuring that all the required business rules are being enforced
at the API tier allows time for much more complete user-experience tests once
the UI is released, and not having to concentrate on testing every single business
rule and path through the application near the end of the project. Ensuring
that the API offers complete functionality allows for easy future expansion of
the application as new business needs arise.
Comments
Post a Comment