Automated Testing – The Key Component of Agile DevOps
According to Dictionary.com, “agile” is defined one way as “quick and well-coordinated in movement; lithe.” It’s a great way to describe an acrobat or athlete, but the term also applies to business. Within software development, the definition’s important because “agile” must happen quickly but also be well planned. Agile’s core tenets are to pull teams together in a collaborative, simple, transparent, and flexible manner, so they can work together to produce quality work on deadline.
Agile involves all of the stakeholders in the process (including customers) to put in their “two cents” during production. A crucial part of this process is testing because it needs to be conducted during every stage of the development. The point of this repeated testing is to gather feedback from all of the stakeholder groups, so the final project will best reflect all of their needs and expectations.
Martin Fowler, one of the original signatories of the Agile Manifesto, describes the need for continual feedback through testing: “The key to this feedback is iterative development. This is not a new idea. Iterative development has been around for a while under many names: incremental, evolutionary, staged, spiral… lots of names. The key to iterative development is to frequently produce working versions of the final system that have a subset of the required features. These working systems are short on functionality, but should otherwise be faithful to the demands of the final system. They should be fully integrated and as carefully tested as a final delivery.”
This quote underscores the need for full testing throughout every stage, not just right before launch. Unfortunately, testing can become a bottleneck. Based on a Gitlab survey, 52% of the respondents said most delays in the development process are encounter during the QA phase.
But why it is so slow? Based on the same report, most of the companies deploy code on demand, but 64% of the companies rely on manual functional testing, 47% perform manual integration testing and 30% do security testing. At the same time, top priorities for companies are quality (47%), time to market (45%) and cost reduction (8%). Taken together, these factors keep continuous integration as the exception instead of the rule.
In order to reach states of continuous integration, companies need to take a different path. Test automation is integral to this new direction and is critical for enabling continuous software delivery. But test automation isn’t a “magic bullet” because it’s challenging and if performed incorrectly can consume more time and efforts than it saves.
Success with test automation requires an upfront investment, and a willingness to have the patience for the investment to pay off over time. It requires the whole team to be on board and to have a plan that details exactly what is being solved through the automation. Answer some key questions on the front end, such a; What are the organization’s objectives for the automation project? How do your test automation objectives support your overall testing goals? How does manual testing fit in with your automation testing plan? What is your expectation of test coverage with automation?
Test automation requires pre-planning and thoughtful consideration of the right tools and approaches that will result in quality code and final projects. The automated tests themselves should also experience continuous improvement and become an integral part of the DevOps pipeline. Consider automation code as production code, and conduct tests as often as possible during each build, feature, pull request and commit. Refine the test over time, and make sure they’re easy to reproduce and understand.
Another crucial element for high-quality testing is the test automation pyramid. Here are three important consideration, with brief benefit/drawback analysis:
- End-to-End tests exercise the whole system, they’re also slow, flaky, difficult to automate and expensive to maintain.
- API, boundary, and \integration tests exercise only part of the application, but they are easier to automate, cheaper and faster
- Unit tests exercise small chunk of code. They are easy to automate, fast, and cheap, but they cannot prove system behavior.
Want a roadmap for test automation success? Here’s a guideline that can provide you with continuously-improving testing that produces high-quality end results.
- Identify end-to-end scenarios by auditing your application.
- Review your list of test cases and determine if the same results can be achieved with the unit and/or API testing. Consistently reduce the number of end-to-end tests if it doesn’t hurt your quality.
- Break down the end-to-end scenarios and prioritize.
- Balance the priority against the benefits. As you compile “buckets” of tasks you should develop cost/benefit ratios. Look closely at development time, execution time, and maintenance time required for the tasks, and then review the gains such as execution speed improvements, repeatability, and experience.
- Automate the “sanity” check tests and integrate them with CI/CD. Automate “winners” first which will cover the most critical scenarios and reduce time spent on the tasks for now and in the future.
- Automate priority 1 tests that can be executed on demand or for release only. There should be a policy in place to review results and tackle failures quickly
- Continually re-evaluate the benefits of automation by refactoring, reorganizing and improving coverage continuously.
Agile automated testing is crucial to the success of any of your projects. Don’t be afraid to work with an outside firm that specializes in such testing and can remove the work from your process so you can focus on other revenue-generating initiatives.