Shifting Left in Software Engineering
Shifting left in software engineering involves bringing testing to the front of the engineering process to find and fix errors early in development.
Join the DZone community and get the full member experience.
Join For FreeShift-left practice in the software engineering field is intended to find and prevent defects early in the software delivery process. The idea is simple: improve quality by planning and moving tasks to the left as early in the life cycle as possible. Shift left testing means testing earlier in the software development process.
Traditional vs. Shift Left
Waterfall, a traditional software development model is based on requirement engineering takes place on the left side of the project planning while delivery and testing requirements are on the right side. The model is not very flexible with changing client’s expectations and requirements and leads to negative outcomes for the business such as increased costs, increased time to market, and unexpected errors.
In my experience spread over two decades, Agile teams also tend to feel testing as the last step in the software development process. Software solution designers and developers normally discuss the requirements early leaving testing behind to catch up later. Squeezing testing in at the end always creates problems as it becomes a bottleneck and doesn’t allow the teams to focus on the next project. Testing is only the bottleneck when people ignore everything else that happened at the same time. In most companies, this is just the way things have always been done.
In the shift left approach, testing is performed during the early stages by moving to the left in the project life cycle. Software developers and testers need to focus on quality from the beginning, instead of waiting for errors and bugs to be discovered late in the Software Development Life Cycle (SDLC). Shifting left enables project teams to test, provide feedback, and review changes & progress daily.
Software Defects and Costs Involved
Several pieces of research done in the past have proven that some 56% of all software defects emerge during the requirement phase, 27% in the design phase, and only 7% during the development phase.
So, how much does it cost to fix a software defect found in different phases? IBM System Institute report revealed that defects identified and resolved during the requirement and design phase are about 100 times less expensive to fix than those discovered after the release of a product.
Another study from the National Institute of Standards and Technology found that if vulnerabilities get detected in the early development process, they may cost around $80 on an average. But the same vulnerabilities may cost around $7,600 to fix if detected during the production phase.
Strategies for Shifting Left
Management Support
Before an organization plans to adopt Shift Left approach, it’s very important that the management and executives understand the benefits of this initiative. Management support can play a big role in rolling out and adopting the initiative as it will impact planning and execution at every level and every role is bound to experience change. So, setting expectations with everyone is required. Management support is also required to continuously receive feedback and create action plans to make it better next time.
Advancing Test Strategies
Test analysts need to engage with solution strategists, solution designers and software architects to understand the feature. This enables the testing team to define a clear test strategy ahead of time. The test strategy in my thought also needs to mention about the coverage based on unit testing, system and integration testing. Test strategy should also mention dependencies on environments, stubs, automation and test data, ensuring that these could be fulfilled by respective teams. Test strategy is an integral part of the Shift Left approach and a starting point for all other activities in the test life cycle.
Requirements and Design Verification
Static testing is one of the ways that I suggest implementing very early in the cycle of the project and includes validation of requirements and design. I call it the “inception” phase. It is done with the purpose of finding defects early in the life cycle that could prove to be very expensive in the later phases of the project. Teams can also come out with a set of questionnaires or checklist to perform the requirement and design verification and validation. I also suggest talking about the dependencies during this time to minimize and avoid any design-related issues later. Its always good to talk about other parameters like availability, security, reliability, performance and day one impact in this phase.
Risk Analysis
Software testing team is suggested to perform risk-based analysis for functional, non-functional and regression types of testing. Testing team should come back to the solution designers and software development team to discuss the likelihood of failure and its impact. This activity can help prioritize the tests and also identify tests that must be run to minimize the risk.
Benefits of Shifting Left
Focus on Test Automation
Shift Left initiative is primarily is focused on increasing test automation. The increased levels of automation while shifting left can help:
- Automate manual testing steps that required a bunch of people to execute manually.
- Drastically reduce the chances of human errors.
- Increase test coverage by running more tests at the same time and decrease chances of an escape defect.
- Allow enough time for testers to focus on more inspiring and fulfilling tasks like exploratory testing.
- Increase the overall quality of the software
Quick and Frequent Delivery
Once an organization achieves a maturity in test automation, it allows the teams to accelerate delivery of projects to the clients early with great quality. Continuously running the tests daily help identify defects as soon as its injected and also prevents defects.
Higher Level of Satisfaction Downstream Organization
Higher quality through shift left initiatives reduces the deployment and day one issues when a client gets the software. This helps increase the level of satisfaction among the downstream organizations who are involved with installation and support of the software product.
Shift Left and DevOps
From a DevOps perspective, we need to look at shift left as an approach used to improve collaboration and communication by engaging stakeholders from functions that are to the right in the delivery pipeline, earlier in the lifecycle. Shifting left requires two key practices – continuous testing and continuous deployment. Continuous testing is the process of executing automated tests as early as possible, along with service virtualization to mimic unavailable systems. In continuous deployment, the deployment pipelines are completely automated, and they have triggered automatically for every change or at an interval.
How to Get Started with Shift Left
- Define the full testing life cycle: Define the testing life cycle with SDLC phases, tasks, and tools. Move relevant testing activities to the initial planning, requirement and design phases.
- Formal design techniques: You can make use of test design techniques such as decision analysis, equivalence class partitioning and orthogonal analysis.
- Infrastructure: It’s important to make sure the infrastructure is in place to support continuous delivery, continuous build, and continuous integration in terms of people, process and tools.
- Requirements validation: Implement a formal inspection method to aid in the early discovery of defects. These inspections may shorten the development phase by identifying missing requirements.
- Integration: The next step is to integrate all the development, project management and operation processes with testing. It helps in identifying the estimated time to complete the testing cycle and prevent duplication of tasks.
- Software Quality Reports: Software quality reports need to be in place in terms of dashboards, daily/weekly emails on the status of pass/fail/no-runs. The project teams must take corrective actions based on the reports.
- Creating test cases: Test cases creation should happen in line with the test strategy and risk-based analysis. This process should take into account the coverage already achieved during Unit testing.
- Automation: Research and Development teams can automate the entire build to test process across all the SDLC phases. This will help provide continuous feedback to the development teams and increase the confidence in the quality of the software.
Conclusion
Shift left is about shifting testing of the software to an early phase in the SDLC. Test automation and DevOps infrastructure are important ingredients to achieve success in increasing efficiency and quality. Shift left model suggests solution designers, software engineers and software testers must collaborate and assume responsibility for delivering high-quality software. Shift left is not a process change – it is a mindset and cultural shift for an organization.
Opinions expressed by DZone contributors are their own.
Comments