API Testing in Web Application

February 01, 2017 | Goutham HM, Software Engineer, Celestial Systems

Introduction
API testing is part of software testing which involves testing of Application Programming Interfaces independent of User Interface. In context to Web Application, API testing mainly involves testing the REST/SOAP Web APIs exposed by application to GUI.


Overview
API testing is done to determine if APIs match the expectation in terms of functionality, reliability, performance and security. API testing happens at data and business logic layer and is done in absence of an GUI. API testing plays a major role in test automation since GUI changes often but APIs remain unchanged for a considerable long time. Automating API tests will be efficient and time saving.
API testing commonly includes testing REST APIs or SOAP web services with JSON or XML message payloads being sent over HTTP, HTTPS, JMS, and MQ.

Why API Testing?
API testing can be used because of the following reasons:
1. API testing mainly deals business logic of a web application which usually remains unaffected by changes in GUI. Even in projects with rapidly evolving GUI, API testing can still be done independent of GUI ensuring that business logic is defect free.
2. API testing also ensures correctness of business logic irrespective of the target devices for web application like desktop or mobile as API testing does not involve GUI.
3. API testing can help detect application behavior problems even before GUI integration.
4. As API testing doesn’t depend on GUI, APIs can be tested even before GUI is developed.
5. API testing can help in regression testing.

When to start API Testing?
In order to have successful functional API testing, there are certain requirements:
1. Identify the API set to be tested based on their development status
2. Identify the input data required for effective API testing
3. Identify the desired output from the APIs
Once above points are established, API tested using API testing tools like Ready! API and mock data.

Three levels of API Testing
The Three Levels of API Testing “APIs, by their nature as being over-the-wire [or network protocol], allow for testing at a variety of levels: behavioral, contractual, and solution-oriented.
● Behavioral API testing ensures that it delivers expected behavior and handles unexpected behavior properly. This is the lowest, most internal value. Behavioral testing ensures that the REST API delivers on the expected behavior and handles unexpected behavior properly. Does the code work?
● Contractual API testing ensures that what is specified by the definition is what has actually been shipped via code. This falls at the middle level of needs. Contractual testing ensures that what is specified by the definition is what has actually been shipped via code. Does the API contract continue to function as we have defined it? With the right inputs? Outputs? Data formats?
● Solution-oriented API testing ensures that the API as a whole supports the intended use cases that it was designed to solve. This falls as the highest, mostly external value. Solution-oriented testing ensures that the API as a whole supports the intended use cases that it was designed to solve. Does the API solve real problems that our customers have? Does it do something that people actually care about?

Key benefits of API testing
1. Less time consuming than GUI functional testing
2. Can be done early in the development cycle without waiting for GUI development to complete
3. Can help to stabilize business logic and help in efficient GUI integration
4. Lightweight XML or JSON data transfer modes
5. Can help in issue localization and isolation during GUI integration
6. Automation can be done in any programming language
7. Helps in regression testing

Ready! API
Ready! API is a comprehensive API testing tool for SOAP and REST APIs. Ready! API offers SOAP Web Services functional testing, REST API functional testing, WSDL (Web Services Description Language) coverage, message assertion testing and test refactoring.
Key Features of Ready! API
1. Create tests directly from Swagger and other popular API description formats
2. Analyze your functional test coverage to know what you’re missing
3. Run ad-hoc tests without having to maintain temporary API client code
4. Use the command-line to integrate your tests into your build system
5. Quickly flip between multiple environments: development, testing, staging, etc.
6. Test REST, SOAP, and other protocols in a single, unified framework

Other Tools
There are few other tools similar to Ready! API which include Postman and RunScope. Ready! API provides better features such as comprehensive report generation, CLI support for to help CI/CD, support for SOAP as well as REST.

Feature Ready! API Postman
Licensed Software Yes Yes
CLI support Yes No
WSDL support Yes No

 

 

HOME     COMPANY     SERVICES     RESOURCES     CAREERS     CONTACT US

Technology Partnership

SENCHA     APTELIGENT     MOXTRA    LEANPLUM     SAUCELABS

 

© 2001-2017 Celestial Systems Inc. All Rights Reserved.