|API Test Automation - Best Practices|
Test Automation is key in today's dynamic software development environment. Features keep on changing, new features are being added. Today's software are not standalone pieces. They are integrated with various other software applications. There is a need for seamless interfacing. Hence every software product publishes APIs. Other product developers use the published APIs for doing the necessary interfacing and integration. Whenever any changes are made to an existing software product, it will again become necessary to ensure that the published APIs are intact and function well as published. Testing the APIs thoroughly will be key and it is highly effort intensive and expensive. Test Automation Framework, hence will need to focus on API test automation as well.
We are developing a Test Automation Framework at Nirmalya Labs which can be used to automate various different testing activities. We are continuously searching and researching. Below are few interesting best practices which is compiled from various sources in internet which we found to be of interesting reading to all test automation professionals.
API testing mainly focus on the business logic layer of the application and it sends the output in the form of responses. Few are the best practices that should be followed in any framework for the API Automation:
1. Layered Architecture: The framework design should consist of different layers loosely coupled to each other. In the middle should, there should lie generic layer that should be the common point for invoking services and retrieving results.
2. Support for different data structures: The framework should support all the data formats supported by API like json, XML, plain text etc.
3. Cache Implementation: There should be a provision of local cache for temporary storage of API outputs and other test data.
4. Inbuilt Parsing Mechanism: Inbuilt mechanism for parsing API input and output to relevant objects will be added help for automation engineer.
5. Basic Validations support: Inbuilt support for some basic validations like verifying API response code, response headers and other data is also highly preferred.
6. Minimal Changes in Scripts: Other than this, the framework should be designed in such a manner such that any changes in API least impact the automation scripts.
7. Structured Test Data: The data to be used in the structured form so that it is easy for the association of test cases and also helps the user in debugging the issue in case of any API failure during execution.
8. Reporting Mechanism: There should be reporting mechanism implemented that should define the output in user readable format rather than in responses. This kind of report will help us to design the failures/success rate in API automation.
9. Services Validation: There should be tests that validates the existing service status so as to ensure that tests gets only executed , if the service is reachable and responding.
Compiled by Mr Rabi Narayan Mohanty.
Ref: Internet Sources
|Comment 13-06-2017 8 : 18 AM|