Shift Left Testing
Tags: testing, codequality
Published: 2021-07-20 17:46:26

Shift left testing approach is a popular technique in the QA industry. The approach was coined by [Larry Smith](https://dl.acm.org/doi/10.5555/500399.500404) in 2001 and has its roots in agile software development. The idea behind shift left testing is to reduce defects earlier and more often so that they are easier to fix, less costly, and less stressful on developers. It answers the problem of accelerating software development without compromising on quality. But what does it mean?

The article discusses the benefits of shift left testing in software development life cycle and key considerations for how a product's success can be maximized by utilizing this approach.

##Shift Left Testing Approach

If you look at the traditional software development models, testing enters the picture at the end of the pipeline, or simply put, at the extreme right side of the pipeline.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i6yp7bmire1808d7i1l9.png)

Even today, most teams feel like testing is the last step in the development cycle. But bringing testing at the very end gives rise to many problems, such as delay in release cycles, low-quality products, or increased development and testing costs. The shift left testing approach pushes testing to the left, or to the earlier stages in the pipeline. This enables teams to find and resolve bugs as early as possible in the development process.


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0oct6dfk7k7xw7kcixkp.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4v01gnvfgsa7a31c42uy.png)

Shift left testing not only increases the collaboration between testers and developers, but it also makes identifying key aspects that need to be tested early in development a whole lot easier

##Benefits of Shift Left Testing

###Increased delivery speed

It's not rocket science that the sooner you start, the sooner you finish. If you find critical bugs early in the Software Development Cycle, you can fix them earlier and more efficiently. This helps in significantly reducing the time between releases, and with that, increases the delivery speed.

###Enhanced test coverage

When you start the test execution right from the origin of the development process, the software can be quickly evaluated or tested for all the features, functionalities, and performance. Shift left testing naturally increases the test coverage percentage. Increased test coverage has a significant impact on the overall quality of the software.

###Streamlined workflow

Shifting left is hard to implement—but worth the time and effort. It gives the QA team enough time to go deeper into a product and implement innovative testing solutions. Moreover, it helps the testing team in getting more comfortable with the tools and technology concerned. Additionally, shift left testing makes it easier to streamline several aspects of the software development process. 

*Example*
Testing early facilitates a stronger bond between business requirements and QA scripts, motivating the team to automate more test scripts as part of the requirements gathering process.

###Reduced development and testing cost
Debugging is one of the most challenging aspects of software development. As a general rule, the cost of fixing an issue increases significantly as the software moves forward in the SDLC. The sooner you find your mistakes, the easier they will be resolved.

Consider an example of a payments app finding a security flaw after releasing its latest app version. Sure, there still would have been some cost to fix if their team had found the issue earlier in development. But now, the company will spend significantly more time, effort, and money to fix it. The complexity of implementing changes in a live production environment really does make it hard to do anything late-stage, not to mention the associated overall costs that come with late stage maintenance.

###The cost of fixing bugs in the real world

[Gartner](https://blogs.gartner.com/andrew-lerner/2014/07/16/the-cost-of-downtime/) has estimated the cost of network downtime to be $5,600 per minute---totaling to over $300,000 per hour. A real-world example of catching a bug in production is Microsoft Azure's leap-year bug that left some customers in the dark for more than 12 hours. The outage was caused by a software bug triggered by the Feb. 29 leap-year date that prevented systems from calculating the correct time.

###Improves product quality

Shift left testing approach positively impacts the overall code quality with stringent and frequent code quality checks. It facilitates timely correspondence between stakeholders, developers, testers, and timely feedback, which helps improve the code quality. This ensures that your customers will get a stable and high-quality end product.

##Best practices for shift left testing

* **Proper planning**: Once the product requirements have been finalized, developers and testers should plan how to shape coding and testing as early as possible in the development cycle. Simply put, shape the development in such a way that it remains friendly to shift left testing.

* **Complete understanding of product requirements**: It is important to make sure that your testing team has deep know-how of the product requirements and actively takes part in all the team meetings to clarify those requirements.
Offer continuous feedback: Developers and testers should be offered timely feedback throughout the software development lifecycle. This helps avoid the unwanted gaps across the teams and helps everyone get involved much better.

* **Specify quality standards**: As developers are not trained in testing from the ground level, QA managers should outline the quality standards so that the developers who are running tests have clarity on the type of bugs to look for.

* **Embrace test automation**: The development team should leverage test automation as shift left testing involves frequent testing. It keeps the pressure off the testing team in providing quick feedback about the stability of the code and checking whether all the functionalities are working as expected or not. Automation drives shift left testing in a big way and ensures minimal bugs are found later on in the software development life cycle.

It makes sense to have a tester work on a feature from the very beginning, and they should get involved in all the project meetings, right from requirement gathering meetings to review code meetings.

###The agile testing pyramid

Created by [Mike Cohn](https://www.linkedin.com/in/mikewcohn/), the agile testing pyramid is a very important model in Shift Left testing---they usually go hand in hand. This model helps testers understand how to implement automated testing. The bottom part of the pyramid represents types of testing that benefit most from automation. As you move up the hierarchy, exploratory testing---on the top of the pyramid--- is non-automated.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2knq1p7pn5xofk6vfok6.jpg)

The pyramid acts as a 'single source of truth' for QA testers to refer back to and meet various needs. Yet, there are still chances that bugs are missing because the agile testing pyramid might not cover edge cases.

##Conclusion

The shift left approach enables the QA team to detect bugs sooner and the development team to fix them quickly before they impact the end-user. This approach not only amplifies the quality throughout the entire software development life cycle but also significantly reduces the overall costs involved and accelerates the release cycles.

It's time to embrace shift left methodology and give your product development a significant push!