Unleashing the power of test automation in software development

Engineers at Macquarie
Macquarie Engineering Blog
7 min readDec 11, 2023

By Sourabh Matta, Lead Engineer in Digital Loan Originations at Macquarie Bank

Overview

The attraction to test automation in software development continues to grow, with an increasing number of organisations adopting and refining strategies and practices to ship their code and features to production for their customers.

At Macquarie Group, in the Banking and Financial Services Technology team, we are transforming the way we are working by putting test automation as a critical component in the software development life cycle, with API and microservices test automation leading the way.

What challenges did API test automation help us overcome?

APIs and microservices are the backbone of modern software applications, and any malfunction or failure can lead to severe disruptions. By thoroughly testing APIs for stability, error handling and edge cases, we can ensure the reliability of our applications and deliver a seamless user experience.

Keeping up with the pace of development “in-sprint”

It is particularly important for agile development teams to perform API tests, as it enables them to maintain fast-paced development cycles while continuously and systematically verifying that their API is working as expected.

Ease to shift left

Automated API testing takes seconds to execute, not hours. We can run an entire testing program in minutes as opposed to the weeks required to do the same thing with manual testing. As a result, automated testing drastically reduces the time your team spends on API testing planning, writing, and running tests — and the cost associated with these activities.

Detect issues as soon as they are introduced

Test automation enables developers to surface issues while they work. By configuring the CI/CD pipeline to automatically execute API tests after every code push will provide immediate feedback while the code is still in progress. If the tests identify an issue, the developer can fix it immediately — before it gets deployed to production and causes user-facing issues.

Enhanced integration and improved reliability

Many features and functionality rely on multiple APIs to interconnect the applications and access data from distinct sources, meaning seamless integration becomes paramount. By conducting thorough API testing, we have been able to proactively identify and address compatibility issues or inconsistencies that may hinder effective communication and data exchange between different APIs.

How we used the API test automation strategy to deploy code to production in less than 5 minutes

In the Digital Loan Origination team at Macquarie Bank, we managed to deploy the code and new functionalities to production for our credit engine in less than five minutes, without compromising the quality of the build.

Some key highlights: -

1. We created the API Test automation framework from scratch to automate all the APIs.

2. We used the test data management techniques to promote the data- driven tests more efficiently.

3. Created the reusable components in the framework that can be utilised by anyone implementing API test automation.

4. Most importantly, all our automated tests are integrated with CI/CD pipeline.

5. For the initial deployment of these APIs, more than 350 automated integration API test scenarios were executed in our CI/CD pipeline to complete the build process within 5 minutes.

6. All the test results report attached to the release ticket automatically via CI/CD pipeline.

Report attached to release ticket

7. All the performance test for all the deployed APIs has been conducted which met our performance SLAs and produced high-quality results.

Illustration of credit engine deployment process

Advantages of automated API test in CI/CD pipelines

In the fast-paced software development world, it is essential for Macquarie to deliver high quality software rapidly. In Digital Loan Originations we have adopted the Bitbucket CI/CD pipeline to integrate code changes frequently and deliver changes in a timely manner. By integrating automated API testing into CI/CD processes, we have streamlined development, fostered collaboration, and achieved superior testing outcomes.

Some of the major benefits of this approach include:

Better test coverage

API test automation delivers with more comprehensive test coverage. Manually testing various factors in complex APIs utilized by modern applications (such as technologies, endpoints, data, and business logic) can be a daunting challenge. Test automation solutions can handle up to 95% of testing operations, enabling significant increases in test volume and scale. This ensures thorough testing across multiple use cases and large datasets.

Enhanced productivity

By including test automation into the CI/CD process, teams can achieve higher productivity. The inclusion of test automation enables more test cycles and a wider range of tests within a given timeframe. This efficiency reduces the time spent on testing and accelerates time-to-market, boosting overall productivity.

Increased test observability

Observability and monitoring are crucial elements of API testing, especially in CI/CD pipelines. Test automation provides valuable insights into API functionality, performance, and security. By incorporating observability throughout the testing process, teams can proactively identify and resolve issues, ensuring the reliability of APIs.

Illustration of test observability

Maximisation of Return on Investment (ROI)

Traditional methods of API testing are resource-intensive and costly. The increase in test timelines significantly impacts project scalability. Automated API testing frameworks develop at Digital Loan origination address these challenges, allowing for broader and faster testing coverage while reducing the overall cost of software testing.

Illustration of ROI

Basic principles to adopt test automation

Understand automation goal: what to automate?

Select and prioritise the most essential and time-consuming test cases for automation, considering the application’s complexity and stability. If production code is released iteratively, we should automate our smoke and regression testing and choose the functionalities that should be automated based on the priority of the tests. This way, we can boost the testing cycles and reduce the time to market.

Identify the simplest approach

Test simplicity is important because it’s not practical to write tests for tests. Code should also be straightforward to read and write. Otherwise, we risk introducing failures with the test themselves, leading to false positives and flakiness.

Low maintenance frameworks and test suite

Regularly review and update your test scripts to ensure they are aligned with the latest application changes. Write just enough tests to be effective and choose the best type of test for the situation. Unit tests are fast and laser-focused, while end-to-end tests cover the UI and are heavy and more comprehensive. A test suite that follows the test pyramid has a healthy variety of tests. Some periodic maintenance will, of course, be needed to keep your tests in good shape. Some best practices to maintain test scripts include:

1. Use version control: Version control is a system that tracks and manages changes to code and scripts over time.

2. Follow coding standards: This improves code readability and makes it easier for team members to understand and contribute to the test codebase.

3. Refactor the code time to time: Refactoring the code is essential during various stages of the testing lifecycle. It helps us to enhance the performance, reliability, and scalability of your test code and scripts.

Parallel execution and scalability

Design your framework to support parallel Test execution, leveraging the full potential of available resources and ensure the framework can scale to accommodate many Test cases and scenarios.

Performance test adoption

Performance testing is one the most crucial component and a key factor in success of any product. It helps to identify how well an application can handle a growing number of users, transactions, and data volumes. Conducting performance tests on regular basis will give us an understanding what our system is capable of.

Creating a single test automation script that covers both functional and performance testing is quite challenging, but it will provide us a holistic test coverage in CI/CD pipelines. In Digital Loan Originations we are experimenting and testing this approach and chosen a tool that is compatible to be used for functional and performance testing and can be seamlessly integrated. We will carefully consider the complexities involved and will try to cover most of the use cases.

Conclusion

Reducing the time to discover a problem after it has been introduced means higher quality and higher productivity. Maintaining a testing mindset is crucial for Macquarie to produce very high-quality products. Quality is everyone’s responsibility and with the test automation we can unlock the true potential of any product and continue to drive excellence in our software development process.

We will soon share how we implemented the automation strategies around asynchronous event driven systems including GCP pub/sub messaging, and how we have automated the GraphQL queries for the first time in Digital Loan Originations at Macquarie Bank. Stay tuned!

--

--

Engineers at Macquarie
Macquarie Engineering Blog

Sharing insights, innovative ideas and ways of working at Macquarie.