API stands for Application Programming Interface which is used to smoothen the interaction between two different application by using any mode of communication. Every time you check the weather or a train time on your smartphone, you’re making use of APIs that enables your smartphone app to pull information from the weather bureau’s applications or the train operator’s train tracking and timetabling systems.
APIs are also helpful in controlling hardware devices and software functions that an application may not necessarily have permission to use. That’s why APIs often play a big role in security.
APIs are an integral part of IoT world that integrates Mobile App with Real devices. APIs acts as a glue that help connect devices, products, facilities, assets and other objects with the applications that make use of the data they generate.
The integration of all devices in IoT is all about API — the interoperable logical connection that allow applications to communicate with each manufacturer’s IoT devices. APIs provides data that enables those devices to transmit data to the end applications, acting as a data interface. Also, they can allow the end application to control the device and serve as a function interface.
Why Testing APIs?
Since APIs is critical in terms of data and works as a bridge between App and Device, they need to be tested to ensure that the data is represented correctly. A perfect working API leads to the perfect working application. Testing the API solves a lot of issues in the application which may arise at some point of time in future. There are many software’s available for API Testing and one such software is Postman.
API Automation Testing using Postman:
Postman is a platform that allows us to develop, use as well as test Rest APIs. It is available as an extension of Chrome and can be downloaded from the following
- With the help of Postman, we can reuse the code(assertions) written for one environment to multiple other environments
- Once developed it needs no maintenance and can be verified at any point of time without any changes
Once the Postman collection runner is ready, it requires to export the collection and execute it from the command Line using Newman. Newman publishes report aa handful after the execution which can give a fair idea of API failures along with the detailed information.
- Newman allows to run and test a postman collection directly from the command line
- It is extensible and hence we can easily integrate it with our continuous integration servers and build systems
- It comes with a Report giving complete information of the execution
Newman is built on Node.js which can be downloaded from the following
Once we have Node.js installed, Newman can be now installed in the machine using the following command : “npm install -g newman”. It can be extended further for receiving wonderful reports using “newman-reporter-htmlextra” that include the separation of the iteration runs and not aggregated together and also some additional handlebars helpers to enable users to create better custom templates.
In order to trigger the execution through Command line with following command:
“newman run “APITests.postman_collection” –environment “ClearbladeTest.postman_environment” -r htmlextra –reporter-htmlextra-title “Newman Run Dashboard”.
Below image shows the dashboard of the report :
Automated Tests Execution using CI:
To complete the entire procedure and make it fully automated from triggering to reporting, we will need to integrate the process with Continuous Integration called Jenkins. As and when development code gets deployed, it can be tested, and the execution of API tests can be done auto triggered through Jenkins. The report of the test execution will be received in the mail box.
Real Time Cloud API Defects:
API Automated Testing results into real time bugs which can be fixed prior to production release and thereby increasing code efficiency and reducing defects in the System. Eg. there was an issue wherein user wasn’t able to delete location/equipment from the App and it was reported prior through API Test Results which helped us maintaining code quality as well as App quality.
API test Automation enables communication and data exchange between two separate software systems. A software system implementing an API contains functions/sub-routines which can be executed by another software system. It helps in creating more robust and bug-resistant programs by increasing test coverage and frequency.
For more details on our Quality Engineering Services, click here.
See how we have helped our esteemed clients to ensure quality of their product – Read Case Studies.
About Author: Shraddha Shah
Shraddha is associated with VOLANSYS Technologies as a QA Automation Lead for more than 2 years. She has vast experience in Web, Mobile and Cloud Automation testing domains.