How Shift Left Testing Works
Shift left testing is a change in the organization’s mind-set moving from traditional quality assurance to new age quality engineering.
Join the DZone community and get the full member experience.Join For Free
Organizations put customers at the center of their digital transformation strategy today. They want to provide a superior digital experience to the customer and use this as a market differentiator.
However, organizations face the challenge of providing enhanced digital experience to the customer with greater agility at controlled costs and reduced risks. Product quality plays a great role in fulfilling these digital goals.
To build high-quality products, companies are adopting new approaches in quality engineering, like shift left testing.
In the traditional waterfall model, the testing process comes after the development life cycle. A slight change in requirements leads to reworking and retesting the entire application. Even in models based on the Agile methodology, testers may only test the allotted user stories without close collaboration with the development teams.
According to many research reports, production defects are a hundred times more expensive to resolve than the defects identified during the requirements and design phases. Shift left testing refers to the practice of testing early in the product or software development life cycle.
The testing team is involved in each phase of design, development, deployment, or integration, much earlier in the life cycle than traditional models. This enables the testing team to find design or architecture defects early on and therefore reduce cost of quality of the product or software.
The testing team can test, provide feedback, and offer reviews on a daily basis. Shift left testing increases focus on non-functional requirements like load, security, or performance testing at an early stage and ingrains the same in the code from the beginning.
Testing early also helps to identify integration defects with diverse systems when the platform or applications are based on a complex modern, serverless, loosely-coupled, microservices-based complex architecture.
The increased coordination and collaboration between the development and testing teams brings everyone together to think about delivery in terms of providing better customer experience. It encourages the testing team to take active participation in the product vision and provides better requirements coverage. Shift left testing is more focused on white box testing rather than on black box testing at later stages, and this helps in reducing technical debt.
Performing early unit testing is easier than performing functional testing due to external system dependencies. In such a case, device virtualization, service virtualization, and simulation can be implemented. These methods make it possible to perform holistic testing even though other systems or applications might not be fully ready yet.
While shift-left focuses on integrating testing with development teams, DevOps (an Agile methodology extension) goes further to integrate operations team, too, in the development life cycle. In DevOps, development, testing, and operations teams work together and automate the build, deployment, and testing process to reduce release cycle time.
There are many tools available in the market that can be used to directly run UI tests from the development environment and integrate it with other DevOps tools, like Git, Jenkins, Bamboo, Ansible, Amazon Pipeline Code, etc. Shift left also means not testing at the end but testing continuously through static code analysis, code reviews, continuous integration, and continuous deployment – all of which makes DevOps the obvious choice of implementation.
Test-driven development (TDD) and behaviour-driven development (BDD) are other popular approaches. In TDD, a piece of code is written to fail first and then new functionality for the same is introduced, resulting in code refactoring. JUnit and Roboelectric are popular tools used to carry out TDD on Android.
Espresso, Robotium, and Selendroid are used to carry out UI tests on Android. Xcode is used for unit testing on iOS. XCUITest automation framework is used to write UI and performance tests on iOS. In BDD, test scenarios are written to portray application behaviour from the end user perspective. Cucumber and Specflow are famous open source frameworks used in BDD.
It is also important to set up a robust shift left testing process in live projects to reap the benefits. The first step is to create a clear test plan by converting business requirements into testing requirements in the project initiation phase.
This will help in finalizing the resource and budget early on, without causing delays later. Risk-based testing helps in identifying the test cases to be executed first in terms of business priority. The priority is decided with a shift left approach where testers discuss the test plan and test cases with business analyst and development team.
Thus, by adopting shift left testing, companies can take an all-inclusive approach for development. This in turn will help companies achieve faster time to market while delivering a superior customer experience. Shift left testing will help considerably improve test metrics, like test execution coverage, defect removal efficiency, defect leakage, defect rejection ratio, automation, and test case effectiveness.
As you shrink the entire development lifecycle by testing beforehand, the schedule and effort also vary minimally. Shift left testing is also a change in the organization’s mind-set moving from traditional quality assurance to new age quality engineering.
Published at DZone with permission of Urvashi Babaria. See the original article here.
Opinions expressed by DZone contributors are their own.