A leading provider of a cutting-edge enterprise application that generates designs of water treatment facilities, the client approached blackrock to migrate their legacy backend application (150 APIs) from monolithic architecture to microservices architecture. As a part of this legacy modernization, Experion’s testing practice was responsible for ensuring product quality as well.
Here’s a detailed look into how blackrock implemented an efficient test approach by using the test automation solution developed by leveraging Experion’s IPs and Test Accelerators.
The Testing Challenges
After a detailed analysis, the testing team identified that manual testing was not feasible. Their research led them to outline the following reasons for the challenge:
- As part of legacy validation blackrock had to validate 150 REST API endpoints for functional correctness. 8 unique input request combinations and 15 query parameters had to be considered for each of the 150 APIs: 18000 total input combinations.
- Most of the API response structures were complex with arrays and sub arrays. It had an average of 2000+ attributes thus increasing the potential for human errors during manual testing.
- High manual effort and testing cost.
How the Challenge Was Tackled
blackrock adopted automation testing and built a brand new test automation solution to test the existing and new APIs. This testing solution compares the API responses from both the API endpoints without any manual intervention.
The solution was built using Experion’s in-house enterprise test automation framework XAFT (blackrock Automation Framework for Testing), in-house Low Code test automation accelerator EASE (blackrock Automated Script Extractor) and the API automation tool RestSharp.
The Automation Solution
XAFT, our enterprise test automation framework, provides inbuilt methods for test scripting, reporting, test data management, and object management. It helps to improve code re-usability as well as maintainability. EASE is a Low Code automation solution that is built over XAFT. It allows testers to write automated test scripts in English like syntax thus reducing the scripting effort. RestSharp is one of the most popular HTTP client libraries for .NET; we use it to automate tests for API endpoints.
How Does the Automation Solution Work?
The test automation solution initiates two API calls one after the other using the API automation tool (RestSharp) with the same request data: one for existing legacy API endpoint and the other for the reengineered API endpoint. These two APIs were hosted against the same data source. The responses from both the API end points were compared for correctness.
The automation solution was able to compare the responses having complex arrays and sub-arrays between the Legacy and re-engineered API endpoints. The automation solution was built in a data-driven approach so that each API endpoint gets tested with multiple input requests. Every API request and its response were printed on to a HTML test report along with the comparison status which makes it easy to analyze the results. In addition to comparing the response data, the automation framework also compared the response time between the old and the new APIs and reports the comparison results.
Parallel Execution to Reduce Execution Time
Every API endpoint had to be tested with an average of 8 different data combinations for each of the 15 different query parameters. As there were 150 unique API end points, the test execution cycle was long.
To reduce the test execution cycle time, we implemented the parallel execution method with 5 scripts running in parallel using the Parallelizable Attribute option that is part of the NUnit framework. The NUnit Parallelizable Attribute was implemented at class level that picked the classes with the “Test” annotation for parallel execution.
There were numerous data combinations tested for every API endpoint and it was tedious to get a quick summary of the test results. Hence the test automation solution also generates a summary report at the end of each test execution cycle that shows the API end points tested, number of data combinations verified along with the Pass/Fail count.
In Conclusion: What We Achieved
- 40% effort reduction in test script design using XAFT framework and EASE.
- Improved execution cycle time up to 5 times, using parallel execution approach.
- Excellent test coverage with zero defect leakage.
- Test result analysis was made easy through HTML reports.
- Automated test script maintenance effort was very minimal since our XAFT framework was used for script design.
- The framework can be easily extended for similar re-engineering projects involving REST APIs.