Shift Left Testing

Shift Left Testing

“The Shift Left Testing Phase which occurs at the end of the development cycle is the first event for which timing, storage, input/output transfers, etc. are experienced as distinguished from analyzed.” – Dr. Winston W. Royce.

The development and Test aspect of an application always goes hand in hand. In the 1950’s, which is known to be an era of ‘Early Days of Software’ there was no concept of a Quality Assurance team or a testing phase per se.

What worked was the fact that – The people who developed the code, also tested the code, and that too iteratively, which means testing a piece of code immediately after development and then moving on to the next feature or functionality for which the code is to be written. This was essentially following the now very popular – Iterative Approach in Software Development. 

In the 1970’s, the Software Development techniques and ideologies revolutionized and the sequential approach in Software Development grabbed all the limelight, thus making the ‘Waterfall Model’ for Software Development immensely popular. Considering that it followed a Sequential Approach, the steps or the phases implemented were quite rigid and were implemented in this particular order-

Requirements -> Design -> Development -> Testing -> Deployment -> Maintenance

For this vastly popular testing model, the Testing Phase came just before deployment which means that the Development phase is already over. Now the major concern with Waterfall is that – You will eventually get the right thing done, but you can not foresee what the cost and schedule might be at the end.

And as we know that more than 60% of the defects are introduced during the coding phase, this will go on to incur high costs for finding these bugs at the later stage. Waterfall stayed on to be popular up until the late 1990’s, and hence the attention to detail and the quality of product were only addressed at a later stage just before the deployment took place. Completing the development phase and then waiting for the defects to be discovered at a later stage not only increases costs but also leads to rework and patching the code which is not an ideal situation.

In early 2000’s Agile model of Software Development was introduced which focused on doing the work taking an iterative route again. The idea was to have a Sprint System (2 weeks or 4 weeks sprint) in which the application was developed incrementally. Here, the rule of thumb that is followed is – A feature or a part of an application is developed and tested and deployed in that particular timeframe of 2-4 weeks and then everybody involved moves on to next feature to be developed.

What it brought to attention was the fact that – Shifting the Testing phase to the left, or we could say prioritizing it earlier in the Software Development Cycle was helping tremendously with finding the bugs very early on and thus saving a lot of time, money and efforts and the best of it being – A happy customer and a Quality Product.

What is Shift – Left Testing?

Shift – Left Testing, as the name suggests is – Prioritizing the Testing phase earlier in the lifecycle of Software Development. This concept fits very nicely into the Agile idea and what it represents. The structure followed is that – The code is regularly tested with each code increment which helps guarantee the quality of software. It idealizes the fact – “Problem Prevention instead of Detection.”

How can we implement Shift-Left Testing?

There are a few approaches which help us prioritizing Testing from early on, some of them being-

  • Test Driven Development – A good approach to Shift- Left Testing is focusing on adopting TDD as an approach towards development. In this kind of set-up, the developers write tests for the piece of code that is to be developed. What it does is – It helps to verify and validate the code immediately.
  • Behavior Driven Development – BDD being another outlook for adopting Shift-Left Testing practices. In this setup, the test steps are written in – Gherkin syntax which is easily readable by all the stakeholders irrespective of the fact that whether they have coding background and knowledge or not.
  • Automation Testing – As we now know that Shift-Left Testing is all about improving quality, it highly compliments and encourages practicing Automation. By doing automation, we can quickly and more regularly get results on how stable the code is after each deployment and also can catch on the bugs pretty early on. Automation also helps with Regression Testing, and not puts the pressure entirely on Manual QA.
  • White-Box Testing – Another way of implementing Shift-Left is to focus more on White-Box Testing, which requires the developers to perform comprehensive testing irrespective of the readiness of the application.
  • Code Reviews – Doing Code Reviews more frequently would ensure a higher quality of code and can significantly raise the coding standards.
  • Continuous Integration / Continuous Testing / Continuous Deployment (CI/CT/CD) – It helps with the implementation of test prioritization as we are testing every integration along the way, and not waiting to test the whole thing altogether.

Benefits of Shift – Left Testing –                       

  • Performing testing from early on in the Software Development Lifecycle ensures that we are finding the bugs very early on, thus saving a lot of time.
  • Finding defects early on is very cost-effective as a defect addressed and fixed at a later stage can amount to much more money thus creating budget issues.
  • It helps avoid worst case scenarios like – Having to re-design an application due to it coming out faulty.
  • Testing early increases the confidence in the quality of a product, and as we all know – at the end of the day, all we are striving for is a- superior quality product.
  • Automation Testing forming an integral part of the Shift-Left practices helps achieve much more test coverage and provides a quicker feedback.
  • Helps maintain the quality of codebase, which is required for future code expansions or service additions if required.
  • Helps avoid Code Patching as much as possible, as it leaves the code vulnerable and not fit for use in future.
  • Performing Testing towards the end of a development cycle can be risky and cause failures.
  • Performing Testing from the get-go helps build a stable, robust and a quality product which guarantees customer satisfaction.

Tools and Techniques to support Shift-Left Testing –

  • Automation Tools like – Selenium, Ranorex, Test Left, Test Complete, Appium.
  • CI/CD Tools like – Jenkins, Bamboo, GitLab, Buddy, Travis CI, CodeShip, TeamCity.
  • Version Control Management Tools – Git, Subversion, Clearcase, Mercurial.
  • Defect Tracking Tools – Jira, BugHerd, Bugzilla, Backlog, Mantis.

Shift- Left vs Shift-Right –

Often people get confused between Shift-Left and Shift-Right Approach of Testing. So, we will try to get it a little sorted here-

                        Shift-Left Testing                     Shift-Right Testing
  1. It is implemented from the initial stages of the Development Lifecycle.
  2. It works on the principle of – Problem prevention.
  3. It involves testing often, shortening test cycles, finding bugs early and avoiding failures in Production environment.
  4. It requires the team to test early and test often.
  1. It is usually implemented in Production environments with live traffic and real users.
  2. It works on the principle of – Problem Solution.
  3. It involves deploying small changes to production, monitoring them and reacting quickly if failures happen.
  4. It prepares the team to prepare for the undefined, unknown and unexpected issues in the Production stage.

Shift-Left Testing | Bug Hunters

CONCLUSION –

Testing early can be a tedious, but testing late can create problems, so it is really essential to indulge in the Shift-Left Testing approach as it helps improve the software quality with its test often technique, short test cycles, automation, cost effectiveness, time saving and helps a project stay within the budget.

And most important of all – It makes for a happy and hassle-free work environment and a happy customer and a superior quality product.

Organizations, big or small are slowly but surely moving towards this approach of Shift – Left Testing due to its benefits and the outcome. If not entirely and abruptly, but surely small steps can be taken to achieve this.

Leave a Reply