Monday, June 16, 2014

API Testing

Q&As
-------------
What is an API?
Application Programming Interface. It is an interface to make HTTP calls with REST or SOAP methods. Both methods can use JSON or XML as their input.

What involves API testing?
API Testing involves testing the response after making a API request. The request and response can be either support JSON or XML format.
It is different than GUI testing in the sense that you test for business logic here rather than concentrating on look and feel of the application.

What tools to be used for API testing?

For API testing, there are several free tools:
in chrome browser:
a) Postman extension: https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en
b) Advance RESTClient extension: https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo

in firefox browser:
a) Poster add on: https://addons.mozilla.org/en-US/firefox/addon/poster/
b) RESTClient add on: https://addons.mozilla.org/en-US/firefox/addon/restclient/

from CLI(command line interface)
curl -v "http://[API call URL]"


What includes a proper API testing?
a) Planning your test cases meticulously - to include below points
b) Each parameters in a API request should be tested for boundary value analysis, null values, negative scenarios.
c) Every error code should be checked so that API code is smart enough to throw an error when encounters something un-expected in an API request.

What are the limitations of API testing?
a) No GUI to help testers with input values
b) A tester should have some coding knowledge
c) Request, response paramaters including error codes should be known to a tester
d) Validation of expected outputs and actual outputs are difficult for a tester to understand

How can API testing be automated?
You can use Jmeter to automate the API testing. Jmeter uses Java.