Thursday, February 19, 2009
API Testing - Begin with a test framework
I recently started doing a project which involves some API testing. Since my knowledge of this domain was restricted and began to learn of lot of things as I started….. This is the first time I thought ill blog about it as I go along.
How to design and API testing framework ???
Coming from an automation addicted software testing background, when I started to study API testing one of the things that I found out (to my delight) was that when it comes to testing API’s, there is not much that you can do by sticking to the age old manual testing routine.
This bought me to the next question, what would be the architecture of an API Testing framework? The following notes are regarding the pre-requisites of your test framework irrespective of whether your API is written in C,JAVA etc etc…. As usual let me start with a picture:
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, your automated test cases should be represented in a ‘parse-able’ format in the config file. Always keep the script highly ‘configurable’.
In the case of API Testing, you would not want to test every API in every test run ( the number of API’s that are tested will dwindle as testing progressing.) Hence your 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.