Introduction
For agile and DevOps teams, shift left means moving critical testing practices earlier in the development life cycle. There are many testing activities that happen late in the development process. This leads to figure out the problem and increases the cost to fix the problem.
When you wait longer to perform the testing activities, your non-functional business requirements like, security, performance is deeply embedded in your code and thus difficult to fix any such issues. In this later stage, all you can do is patch those up rather than fixing those.
Shift left is about doing the identification and prevention of issues as soon as possible in the software development life cycle.
Finding and fixing software defects
The below graph indicates the increasing cost of the defects as they are introduced into the software at every phase of the software development life cycle.
The first blue line is showing the defects injection into the software across all phases of the development life cycle. It displays that the majority of defects are injected during the coding phase. Whether they are by mistakes, misunderstand the requirements or do not think through the consequence of a particular piece of code. Defects are introduced during the integration of different modules of the software, especially when multiple teams are involved.
The 2nd orange line of the graph shows, when the defects are detected. This is not surprising, you find defects when you start testing. It can be difficult to start testing without a proper infrastructure/interface before everything is ready.
We come to know here that most bugs are introduced during the coding phase but they never found at that stage. Now it becomes important to understand the difference in cost to fix bugs at every stage.
The third red line on the graph shows the cost of bug fixes at every phase of the development lifecycle.
It is interesting, as we see the crazy hike in the cost of bug fixes, the later it is found and fixed. Letting the bug pass through and fixing it at the system testing phase is 40 times the cost of finding the defect at the coding phase. It is ridiculously expensive when you see the numbers of letting the bug slip through to the actual deployment.
There are the following reasons for this cost escalation:
- The time and effort to find the issue. The more complex the test case is the more difficult it is to track the real problem.
- The challenge of reproducing the bug on developers’ computers as other dependencies like, Database, third party APIs may also be involved. In a common scenario, there could be a several weeks lag between defect detection and defect reproduction.
- The impact of the change is needed to fix the issue. It could be interlinked at many places in the code. If the wrong framework or resource is used, code is not scalable enough for the expected performance parameters, then it is a big problem.
The reason behind Shifting Left
Now here is the same graph with a new orange line. It shows the proposed defect identification cycle based on early testing. You can see the curve growing big on the cheaper side and getting smaller on the expensive side which means significant cost reduction.
The shifting left technique relies on mature development practice. Developers create and execute unit tests that cover the code reasonability well. Then functional testers and API testers do as much as they can to minimize the dependency on later stage test cycles. So you have good enough tests already done to prove that everything is working. The later stage tests are to prove the functionality not to find bugs.
Some organizations stop at this point only. But it can be taken further left into the coding stage. As bugs are introduced in this stage so you can start finding issues when development is still on.
This is where we can apply static code testing. You can start finding bugs during the actual coding phase when the cost of finding bugs is at its lowest level. Find the defects before testing begins is very cost-effective and it saves time also.
Applying the Shift-Left Approach
The shift-left testing approach can be categorized into two main activities: one is applying development and testing best practices and second is leveraging service virtualization to enable continuous testing.
Doing earlier-stage improvement practices, like static code analysis and unit testing, enables you to identify and reduce defects earlier within the process. It’s crucial to consider that the goal is not to locate bugs but to lessen the variety of bugs, especially those that make it into the release. Ultimately, creating fewer bugs within the system is far more valuable than finding more bugs.
Below is the maximum utilized Shift-Left approach graph:
Coding standards are key to lowering the volume of bugs and getting the most value out of your shift-left initiative. These standards help you to keep away from bad, dangerous, or insecure code via static code analysis. Coding standards also let you build a more steady and secure application from the beginning.
Next, you must take the tests that have been created at all stages of the development process, consisting of the later levels, and execute them continuously shifting forward. Unit tests can easily be executed, but shifting left the execution of later-stage tests is usually difficult due to external dependencies. This is where you may leverage service virtualization to enable continuous testing.
Service virtualization allows you to simulate dependent structures that could have restrained availability, together with mainframes, third-party services, or perhaps structures that just aren’t prepared yet. By simulating them, you can carry out purposeful testing without having the whole system available.
FAQ
What is Shift Left approach?
For agile and DevOps teams, shift left means moving critical testing practices earlier in the development life cycle.
What happens when testing is done in later development stages?
When you wait longer to perform the testing activities, your non-functional business requirements like, security, performance is deeply embedded in your code and thus difficult to fix any such issues. In this later stage, all you can do is patch those up rather than fixing those.
Why do finding and fixing the bugs at later development stages cost more?
There are the following reasons for this cost escalation: -The time and effort to find the issue. -The challenge of reproducing the bug on developers’ computers as other dependencies like, Database, third party APIs may also be involved. -The impact of the change is needed to fix the issue.
What are two main categories of activities in Shift-Left approach?
The shift-left testing approach can be categorized into two main activities: one is applying development and testing best practices and second is leveraging service virtualization to enable continuous testing.
jQuery presents a tree-like structure of all the elements on a webpage simplifying the syntax and further manipulating such elements. The jQuery Certification exam by StudySection will secure your fundamental knowledge and a basic understanding of jQuery as an asset to improve your skills.