Automation of API Testing for Network Application Case Study
The Client
The leading open platform for network, application, and cloud monitoring for companies with heterogeneous operating systems, application and hardware environments who want to reduce ongoing monitoring costs.
The Need
Our client was looking to test their RESTful API using test automation. The testing included sending HTTP requests to the server and retrieving and validating the XML response.
The Challenge
The RESTful API test automation was to be integrated with the client’s continuous integration tool, Jenkins, in order to become part of their smoke testing on daily builds.
The Process
- Review requirements and created a detailed test plan.
- Created the automated test suite using Watir webdriver.
- Setup Cucumber and used it to transform the existing test cases to BDD feature files.
- Created execution jobs for CI and scheduled the test script execution on Jenkins.
- Identified defects early in the cycle to increase the system stabilization rate.
- Reviewed test results then emailed the results to all stakeholders.
- Introduced a matrix indicating level of test coverage in the release.
How Optimus Helped
In order to help our client meet their testing needs, we quickly understood the requirements and created a high level plan consisting of breaking down the methods to be tested in a detailed project plan. We proposed to use the Cucumber framework for automation because of its ease of use and powerful capabilities; therefore, the automation scripts were coded in Ruby.
We included HTTP client and nokogiri libraries for generating requests and parsing the response. We then created the test scenarios in Gherkin language which were easy to be interpreted by all stakeholders.
We automated the test execution and integrated with Jenkins for scheduling along with daily builds. Test results were shared with the stakeholders for their review and feedback.
Our client was satisfied with our automation plan and process. The automation helped them reduce significant effort in the manual testing while increasing their confidence in the stability of their solution.
Test Automation Project Details
Scope of Test Automation
- Web Application Test Automation using Cucumber
- REST API Test Automation using Cucumber
- Browser coverage for all tests IE, Chrome and Firefox
REST API Test Automation Schematic
Key Features of Cucumber Framework Used
- Gherkin used for easily readable test steps based on BDD approach.
- Test cases and test data are stored in feature file.
- Test script code saved in step definition file.
- Page object model to make the code reusable.
- Focus on popular open source tools: TestLink, Jenkins, Selenium, Cucumber.
- Test result reports in HTML format with screenshots of failed steps for debugging.
Test Infrastructure
- Maintained in the client’s hosted environment (Colocation & AWS)
- Consists of reusable VM infrastructure including machines for different Linux flavors, e.g., RedHat 6, SLES 11/12, CentOS 6 and Ubuntu 12.04/14.04
Test Reports
- Scenarios automated on day-to-day basis
- Cucumber-generated HTML report with pass/fail information
- Reports generated on Jenkins through Cucumber-Reports plugin
The Benefits
Optimus Accomplishments | Advantage to Client |
---|---|
Complete automation of REST API testing using existing framework. | Saved the overhead of creating new framework for REST API. |
Increase automated testing from 25% to 60% of test coverage. | More efficient and reliable test execution. |
Start of non-functional testing. | Client got the performance data for further action and measured improvement for end users. |
Selenium Grid POC. | Enabled specification framing of the Selenium Connector. |
Improved test result reporting in matrix form. | Better visibility on compatibility of multiple OS with different monitor configurations. |
Migration of test automation framework from Linux to Windows environment. | Increased number of test environment available. |