Automated testing of REST API
Executive Summary
Our clients, a California, USA based smart and innovative IT solutions provider (Healthcare Management industry) wanted an automated test suite for REST APIs they have , which takes a major role on delivering the core business logic to the applications on various platforms, used by end users. Automating Http based REST APIs which needs the complete understanding of functionality/business logic of the project itself was a challenging and well experiencing task for us. We provided an automation solution which makes sure that every new build has minimal defects by providing reports for Bugs. We provided solutions like test case updation and maintenance of the script for the new builds of the application with added features at a later stage. Automated test of APIs (consumed in all the applications which are customer facing), opened the door for very early detection of defects – even before we find defect on UI level.
About our Client
Client Description: A major innovative and smart IT service provider in Healthcare management domain (IOT based)
Client Location: California, USA
Industry: Healthcare Management
Business Situation
Our client wanted an automated test suite for the REST APIs they have , which has a major role on delivering various crucial data to the customer facing applications made for different platforms. They wanted the project to be hassle free, which can be easily executed by anybody from their end and to output easily interpreted test results. They looked for fully automated solutions that would be a suitable candidate for integration with Continuous Integration tools like Jenkins. The idea behind automating APIs was to have a complete regression suite which can output defects before it breaks the UI severely. Our client wanted this regression suite to be flexible enough to be executed with any of the testing environments along with production itself, with any set of credentials. Not only the validations were to be done from a set of expected results , out client wanted data to be matched from the application database on real time basis.
Our Solution and Customer Benefits
We suggested an approach of combining Apache HttpClient , JSON/XML/HTML parser libraries, JDBC dependencies along with other supporting Java libraries to achieve the goal we had set. Apache HttpClient is a great tool to interact via http protocol and complements other libraries like JSON parsers to be easily integrated with it. This approach best suited the requirement of CI support and better test coverage.
We wrote test cases covering positive ,along with negative test scenarios which helped protecting APIs from a security point of view.
We validated test expectations from the application database using JDBC.
We prepared documentation containing instructions to handle script running in Mac OS and configuration details etc.
Divided the test suites according to the functionality of the application to best suite Job configuration with Jenkins. We configured the Jobs with a VM provided by client using Share Screen and configured that machine to be friendly with the script run.
Our automation test reports gets generated in HTML, Spreadsheet and csv format as well. Demonstrating test results test case wise (along with complete request and response details), which helped client to figure out the exact portions of the application which has defects.
Later we integrated our automation test suite with a test case application which made defect tracking process an automated solution. Whenever a test case fails , it saves a record in test case application database and at any point of time , we can track which build had the issue on which date.
Technologies
Apache HttpClient,org.json(JSON Parser), Java, Eclipse, Maven, Jenkins