How “Shift-Left” Testing Can Help Your Product Quality
Call all the QA people that you know and tell them the good news once you've read this article,
Join the DZone community and get the full member experience.
Join For FreeWith the evolution of the software industry, new trends and operating models also evolved and each software model aimed at bringing more efficiency at every stage of software development. Having more efficiency was the most immediate since any delay in project execution and delivery could delay the shipping or launch of the product. One of the most widely used software development models was the Waterfall Model where all activities in a software development lifecycle, namely planning/requirements gathering, software design, coding (development), and product testing, were executed in a sequential manner. The major drawback with the Waterfall Model was that the testing activity was not performed at every stage, and bugs (major/minor) were unearthed only after the product development was complete. If the bugs are minor in severity, developers can fix the issue and submit the changes for verification. The scenario would change drastically if the severity is very high and there could be side effects of the fix. In such cases, there could also be a potential delay in releasing the product to the customer. In such a model, the testing phase was there in the extreme right of the SDLC and that approach is ideal if your product is bug free, but that is never the case with any product.
Shift-Left Testing: Empowering the Test Teams
With the evolution of different software models, like the Agile model, Incremental model, and Spiral model, people realized the importance of software testing. There were a significant number of risks that were involved by keeping testing as a one-off activity since it had a lot of implications on the project deadlines, as well as the cost. This realization gave rise to the concept of Shift Lift, shifting the testing phase to the left and empowering the test team by involving them in activities that are critical to the execution of the project. In the earlier testing methodology (called Shift-Right), testing phase was at the extreme right/at the end of the development cycle, whereas in case of shift-left methodology, testing is involved at each phase of the development.
In a traditional software development approach, test teams work in silo since their primary job is to improve the quality of the product by identifying bugs and reporting them to the development team. There was less or no involvement of testers in an important phase of product planning and development. With the concept of shift-left, the testing team is more involved in every phase of product development. With such an approach, the testing team could collaborate with other stakeholders, like the development team, product planning team, product development team, and marketing team, thereby inculcating a mindset of testing at a very early phase of the development. Since the test team gets an opportunity to interact with the members from different teams, this enhanced understanding will help them in writing effective test cases that can be instrumental in improving the product quality.
Hence, the concept of shift-left not only helps in discovery of bugs at an early stage of product development; but it also helps the testing team to collaborate with other stakeholders, improve domain competency, and come up with more realistic test cases.
Major Benefits of Shift-Left Testing
As you roll in the shift-left testing as a part of your SDLC, you may realize many benefits. In my opinion, those mentioned below are the most beneficial ones.
Reduced Costs Involved in Development and Testing
Larry Smith, the founder of the shift-left concept, once mentioned bugs are cheap when caught young. In a typical SDLC, testing is performed at the end of the product development cycle. As mentioned earlier, the cost and implications involved in bug-fixing would multiply based on the time when it was discovered. Per Larry Smith, bugs have to be discovered early before they become undiscoverable.
Once you shift left, testing is considered an integral part of every phase of product development. Hence, testing is performed once every build so that bugs are discovered and fixed at an early stage. Once the code size becomes more humongous, fixing simple issues could also take more time and may cause some side effects. A shift-left testing strategy can reduce the overall costs of development, testing and fixing since bugs are caught young!
Early Bug Detection Ensures Better Code and Product Quality
Shift-left approach ensures that there is timely communication between different stakeholders of the project. Developers can co-work on the development of unit tests, as well as system tests. Automation is an important part of shift-left testing and with automation scripts, test teams can perform testing several times a day. Their product feedback in the form of bugs is again fed back to the product development funnel which helps in improving the code quality (as well as code coverage through the development of test cases and test suites).
This results in a reduction of the number of issues that are encountered during the production phase and a critical bug in the production phase can cause havoc in the team. For instance, the test team encounters that the sign-up page on their web product is not working due to some database issues or the power consumption for the call scenario in a mobile phone is much more than competitors products in the same price range. This means that the overall code quality would improve with the stringent code quality checks, hence ensuring a more stable end-product is delivered to the customer.
Still Not Sure About Shift-Left Testing? Here Is How It Can Help Your Product Quality
The fundamental difference between the shift-right and shift-left testing approach is the involvement of the test team at every critical phase of software development. From unit testing in the development environment to migration in the staging environment before pushing the final code into a production environment. However, implementing this approach is easier said than done since the test team needs to get out of their comfort zones and a mindset shift is required from each stakeholder so that they can collaborate with the test team for the successful execution of the project. However, you must be wondering whether shift-left testing can really boost you deliver a product more robust than ever with better team collaboration and efficiency.
Below are some of the major highlights by which shift-left testing can help your product quality do better.
- In the shift-left testing approach, the test team is involved in important project discussions which makes them more informed about the project requirements. In the process, the test team will gather a good amount of knowledge about project planning and execution. This will motivate the team to do much better in their day-to-day activities since each day the team will come across important learnings.
- Apart from the product/project planning team and development team, not many members are aware of the business goals since they never had access to that information. With shift-left testing, software testers can play a vital role in ensuring that their work helps in meeting the business goals of the group/organization.
- In today's time where the entire focus is on time-to-market, delivery and execution timelines have become shorter. This is where Agile and DevOps would require more automation so that the testing process can be accelerated. If the automation scripts have to be developed by the test team, it could slow down the automation process. With shift-left testing, the test team would work closely with the development team to come up with automation test cases that can be used to unearth critical issues in the product. By following such an approach, there would be improved synergy across teams which is a very important aspect for achieving Behavioral-Driven Development (BDD) and Test-Driven Development (TDD).
- There is a common misconception that developers have to only develop the code. In order to improve the code quality, developers should ingrain a development and test mindset so that the developer can himself discover and fix the bug. By implementing the shift-left approach, developers can become more responsible by focusing on developing and testing simultaneously. This would help enhance the soft skills of developers, required for becoming more proficient.
- Test team members who are involved in the implementation of automation scripts are technically sound with multiple test frameworks and programming languages. However, members from the test teams are never a part of the review board. Once shift-left is implemented, testers can be a part of the regular standup meetings, code reviews and other important activities that are part of the product development. This knowledge can be useful in future projects since testers can come up with more test strategy, test plans, and test cases since they are involved in every phase of development.
- Traditional Shift-Left Testing: The traditional shift-left testing approach focuses more on unit-level testing and integration testing. This is achieved via usage of API testing and utilizing test tools. It does not put more emphasis on acceptance testing and system level testing.
- Incremental Shift-Left Testing: Incremental shift-left testing is widely used in projects that have very high complexity. In order to reduce the complexity, project tasks and deliverables are broken down into smaller pieces. This approach makes the testing task a bit easy since testing is also performed on those smaller pieces. These pieces are built upon each other, with each increment; the software is also delivered to the customer. After each delivery, the development and testing are incrementally shifted to the left. Projects involving hardware considered extremely complex as there are a lot of dependencies i.e. hardware, software, middleware, application layer, etc. and incremental shift-left testing is widely used in such kind of complex projects.
- Agile/DevOps Shift-Left Testing: As the name signifies, this category of shift-left testing is performed in numerous sprints. It is mainly used for developmental testing and not for operational testing. Agile/DevOps shift left testing is slowly gaining popularity and organizations are using this approach of shift-left testing depending on project requirements and schedule.
- Model-Based Shift Left Testing: The entire concept of shift-left testing is identifying issues/bugs before it becomes too late. However, in the previous types of shift-left approaches (discussed so far), testing would start at the early stage of the development cycle. Hence the issues that could have been identified during the requirements gathering/design phase, would be unearthed once the software is ready. The major problem is close to 45~65% defects are introduced during the requirements gathering phase, design phase. In model-based shift-left testing, testing can start at the earliest so that bugs are reported long before the software development cycle has started.
Shift-left testing when implemented correctly, can result in improving the domain skills (of developers, testers, etc.) and improve the intra-team communication which is vital for the success of any project.
Which Shift-Left Testing Model Is Best Suited For You?
Shift-left testing can be practiced in 4 different ways:
To summarize, shift-left testing is more about continuous testing at each phase. There is an ample number of benefits for moving to shift-left testing, but it is left up to the product development team whether to adopt that approach depending on the project type and project schedule.
Published at DZone with permission of Harshit Paul, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments