In a traditional software development lifecycle (SDLC), the quality assurance (QA) team tests software when it’s fully implemented and ready for release. The problem is that discovering and fixing critical issues at this stage can cost a fortune. For example, if the QA team finds an unimplemented requirement or an architectural flaw, the development team will need to rewrite tons of code.
Shift-left testing is a QA approach that mitigates this risk by starting QA activities early in the development lifecycle. In this article, we discuss what is shift-left testing, how it works, and how an IT development project can benefit from early testing. We also share our experience adopting shift-left testing and key technologies we use to do so.
This article will be useful for QA and project leaders that are looking for new ways to improve testing procedures on their projects.
How is shift-left testing different from standard testing?
The traditional SDLC establishes a linear progression of activities, where each stage is separate. The QA team can start testing only after developers finish coding the solution, and they have to finish all quality assurance (QA) activities before deployment.
Shift-left testing is part of the continuous integration (CI) and continuous delivery (CD) approach to software development that suggests involving the QA team in the early stages of the development process. The key shift-left testing principle is literally shifting testing left in the software development cycle — closer to the design or even requirements gathering stages.
This approach allows QA specialists to start working on the product’s quality when the product exists only as an idea. They can test the product’s concept, analyze requirements, work on testing documentation, etc. Then, the QA team creates a testing strategy for the project and estimates QA-related tasks.
In flexible and iterative development methodologies like Agile, shift-left testing also helps to ensure the quality of each released product version.
With the shift-left approach, a testing strategy entails QA activities at each stage at the SDLC:
Carrying out QA approaches at each stage of the SDLC provides lots of development and business advantages. Let’s take a closer look at key shift left-testing benefits.
What are the benefits of adopting shift-left testing?
Shift-left testing emerged as a response to the limitations and disadvantages of the traditional SDLC:
- High cost of fixing an issue. The later your team discovers a bug or an incorrectly implemented requirement, the more challenging and costly it is to fix.
- Long time to market. If you detect a serious issue before product deployment, you may have to postpone the release to make time for fixing and additional testing.
- Unforeseen post-release errors. Because of insufficient time to test a product or incorrect testing requirements, your QA team may overlook critical software issues. Discovering them after release will lead not only to additional spending but also to reputational damage and loss of clients.
Starting QA activities early in the development cycle allows your team to build the product with quality in mind. They can discover critical issues as early as possible, or even avoid them completely.
“To find defects early, both static and dynamic test activities should be started as early as possible in the software development lifecycle. Early testing is sometimes referred to as shift-left. Testing early in the software development lifecycle helps reduce or eliminate costly changes.”ISTQB Foundation Level Certification Syllabus
At Apriorit, we adopt shift-left testing approach in our projects that use continuous integration and continuous delivery methodologies. Any CI/CD pipeline heavily relies on the automation of routine processes and frequent releases. Combined with shift-left testing, CI/CD allows our team to increase test coverage and reduce the number of human errors while delivering a quality product with each release.
We have experienced the following benefits of the shift-left approach to testing:
Time and cost savings on QA activities. Starting QA activities earlier in the SDLC doesn’t mean you’ll need to do more tests than with the traditional lifecycle. On the contrary, an early start helps your team detect and fix quality issues before they turn into serious problems. When you discover the same issues right before product release or even afterwards, they take much more time, effort, and money to fix.
Faster time to market. Building a software product with quality in mind and continuous testing of each release helps your team ensure there are no critical issues and vulnerabilities in the pre-release version. They won’t need to conduct lengthy testing before the release or postpone it to fix issues.
Improved user experience (UX). When QA specialists start working on a project at the requirement gathering stage, they can add great UX principles to the software’s foundation. Then, they can validate a smooth UX during each iteration and for the final product release.
Satisfactory product performance. Shifting left performance testing allows your team to reduce product downtime and interruptions by enabling them to eliminate bugs that cause such issues at early development stages. They’ll also have time to optimize the product’s code to ensure smooth performance and test its scaling capabilities.
You can improve CI/CD with shift-left testing and achieve various goals during development. Let’s explore a few common examples in the next section.
Which shift-left activities can you adopt?
At Apriorit, we engage QA specialists at the very beginning of the CI/CD workflow and to carry out the following activities:
After business analysts discuss all functional and non-functional requirements with the client, QA engineers examine these requirements to determine whether there are any quality-related issues. Thus, it’s possible to reconsider potentially problematic product requirements and address quality concerns at the very beginning of the project instead of rewriting code once the product is ready. This allows our clients to save a lot of time, effort, and development costs.
This review also allows QA specialists to study the product and start working on test artifacts for it: documentation, testing strategy, test cases, etc.
Creating a testing strategy
After QA specialists have reviewed and agreed upon all product requirements with the client, they can start working on a testing strategy. This strategy contains high-level descriptions of:
- All QA activities planned for the project, from module to user acceptance and post-deployment testing
- Automated activities
- Planned QA stages
- The QA team’s line-up and responsibilities
Such a strategy helps the QA team analyze the product’s environment, dependencies, degree of automation, and available test data. Software developers also take part in reviewing the testing strategy and QA documentation. It allows them to synchronize with QA priorities, goals, and planned activities.
Depending on the needs and specifics of each project, we choose a testing model that defines how we approach QA activities:
- An analytical (requirements-based) strategy is the main test strategy for the project. This model suggests building test cases and planning QA activities based on analysis of product requirements. You can apply it to the whole project, but we generally use this strategy to identify and analyze requirements, test conditions, and risks.
- A consultative strategy is complementary to the analytical strategy, as it helps to cover gaps in QA activities at the analysis and design stages of the SDLC. This model relies on consultations with project stakeholders to define and elicit product requirements. A consultative strategy emphasizes meetings with subject matter experts and test case reviews performed by them.
- A reactive strategy helps us improve test coverage with experience-based tests during the implementation and execution stages of the SDLC. This strategy includes exploratory testing, test design, and test implementation.
- An automation (regression-averse) strategy makes the QA team apply various techniques to manage the risk of functional and non-functional regression test automation at one or more levels. This strategy helps us reduce regression testing efforts as well as get a quick response regarding version quality right after deployment. You can apply this method particularly during unit testing, integration testing, API testing, end-to-end testing, automation environment tuning, and autotest code reviews.
At Apriorit, we prefer having both a high-level testing strategy for the whole project and several low-level strategies to work on particular product functionalities. Such a combination allows us to be flexible when choosing QA activities, save time and costs on testing, and form a single vision of the product within the QA team.
Test case design
After finishing the testing strategy, you can start designing test cases for functional, non-functional, and end-to-end testing. The process of designing test cases for the shift-left approach is the same as for the traditional QA process. However, shifting these activities to the left helps you write documentation and prepare test cases before any code is implemented. This shift gives the QA team time to review test cases, improve their quality, and discover any issues and gaps with product requirements.
Early test case design allows the QA team to double-check product requirements, specifications, and already written documentation. They can review the requirements and ask the project’s BA to conduct additional interviews with project stakeholders and edit these documents without affecting the development process.
Static testing is when the QA team looks for issues in software before executing it. Its goal is to find issues with product quality at the early stages of the development cycle. At Apriorit, we start static testing as soon as we finish working on product requirements and test artifacts.
Here are the activities we include in our static testing process:
1. Manual review of test artifacts
When all project documentation is finished, the QA and development teams start reviewing it to eliminate any mistakes and ambiguities, to provide feedback to other teams and stakeholders, and to form a unified product vision.
At Apriorit, we review the following test artifacts during all SDLC stages:
- Software prototype
- Prototype specifications
- Test data
- Traceability matrix
- User manual and tutorials
- Testing strategy and test cases
- Automation and performance testing scripts
Compared to requirements testing, at this stage we review a wider pool of test artifacts and engage the development team. Participation in this review allows developers to take into account all test cases when designing the product architecture. This way, developers can provide precise estimates for development tasks and prevent quality issues.
Planning test coverage and types of tests for each level of development in advance helps to make sure that code is efficiently covered with tests. It also allows for avoiding miscommunication between the development and QA teams.
2. Planning test coverage
Early planning of code coverage helps to provide exact estimates for QA activities, improve the quality and stability of our code, and discover issues before the release version goes to the QA team. At Apriorit, we determine the necessary level of test coverage with automated and manual tests when discussing product specifications.
Automated tests help us reduce the product’s time to market, detect bugs early, and spend less effort on manual testing. We try to cover our code with low-level autotests at the unit and acceptance test levels of the test pyramid.
Such tests are written mostly by developers in parallel with the coding process. They prioritize unit tests and switch to writing integration tests only for cases they can’t cover with unit testing.
Developers cover their code with tests according to the requirements and principles laid out in test artifacts. This way, they can choose the most suitable tests and testing levels to cover both the code and test cases provided by QA specialists.
3. Creating a checklist for development testing (DevTest)
When working on test cases, QA specialists also create a checklist for development testing. This checklist includes priority checks, such as checks of the business flow and key functionalities that the development team has to verify before passing their code to the QA team.
A DevTest checklist helps to reduce simple software errors and the time needed for the QA team to find these errors and return software to developers for fixing.
4. Static code analysis
Static code analysis involves analyzing code with dedicated static analysis tools that help to find possible quality issues and security vulnerabilities. Such tools automatically compare your code to a set of default or custom coding rules and detect possible errors.
Before filing bug reports, QA specialists have to manually review suspicious pieces of code to make sure there is indeed an error. However, static code analysis tools save the QA team a lot of time, as they read and compare code faster than any human can.
At Apriorit, we usually analyze code with SonarQube. This open-source tool is easy to integrate into your CI/CD pipeline. It not only checks code for errors but also highlights issues with code security, readability, and maintainability. SonarQube scans all new code added to a build and automatically sends out a report with its findings.
5. Unit and integration testing at each build
Repeating regular unit and integration tests, monitoring their status, and fixing new issues allows us to discover issues in new builds before they’re passed to manual testing. If any tests fail during a regular checkup, you should consider the whole build as failed, and this status blocks it from going to the QA team. Developers get a high-priority ticket with the issue that caused build failure and should fix it as quickly as possible to resume the build.
Running module and integration tests before building the product helps you reduce the number of testing cycles, shorten the product’s time to market, and receive more stable software.
We worked out and adopted the practices discussed above to shift-left testing as a result of trial and error in our projects. Let’s take a look at the best practices for adopting shift-left approach to software testing so you don’t repeat our mistakes.
Best practices for shift-left testing
Adopting the shift-left approach to software testing is challenging for any team that’s used to working with a traditional linear SDLC. If you decide to use this approach, you’ll need to change not only your usual workflow but your mindset as well. Consider following these best practices to ease the process:
1. Accommodate the cultural shift
The shift-left approach to testing is not about adopting new tools and testing strategies — it’s about changing your attitude towards QA processes and focusing on continuously improving code quality. Shifting any processes left in the traditional SDLC causes a change in the usual responsibilities and workloads for QA and development teams. Such changes can put additional stress on the team or even make it resentful towards the new approach.
You can help QA and development teams adapt to the new approach by:
- Explaining the benefits of shift-left testing and providing real-life examples
- Engaging QA and development specialists in the adoption planning process
- Showing support for the new QA approach among top management
- Giving your teams time to adjust to the changes
- Balancing the load on your teams
2. Allocate more QA resources at the start of the project
In the traditional SDLC, QA specialists are involved in the project towards the end of the cycle. They don’t have a lot of tasks at the beginning of the project.
But in shift-left testing, the QA team has to start working on a new project from the first stages. Therefore, make sure you have enough QA engineers who are available and can participate in a review of project requirements.
Also, check that QA specialists have:
- Enough time to create and review test artifacts
- An allocated budget
- Required tools and resources
3. Limit the scope of testing for each release
When you need to continuously work on product quality and test each build before release, there’s a risk of planning too many QA activities for a cycle. And since all product-related processes in the shift-left approach are interdependent, having too big of a QA scope may slow down other processes and increase the development cost. This way, overplanning can cancel the benefits of shift-left testing.
To keep the scope of QA activities under control, limit it to the following tests:
- Tests that cover all new and changed pieces of code
- Functional tests
- Relevant exploratory tests
- Security and performance tests
You can also adopt test automation and scriptless testing whenever possible to speed up QA activities.
4. Introduce your QA team to coding
Shift-left testing brings QA and development teams close together: developers can review test artifacts and write tests, and QA specialists can review coding standards and implement coding practices. In particular, QA specialists can work on code testability standards and coding quality criteria and can review development documentation.
To be able to provide the development team with valuable insights, your QA team has to understand basic coding principles, workflows, languages, and tools chosen for the project. If your QA specialists don’t have this knowledge, you can:
- Arrange basic programming training for them
- Ask your development team to organize lectures for the QA team
- Hire an outsourced QA team that has the needed experience
5. Ensure continuous feedback between QA specialists and developers
As part of the CI/CD pipeline, shift-left testing requires QA specialists and developers to communicate constantly. This communication must start at the beginning of a project and should be much more meaningful than in the traditional SDLC, where QA specialists can simply write bug reports and expect issues to be fixed.
To facilitate communication and continuous feedback between teams, you can:
- Implement a tracking and reporting system in your SDLC that will keep a record of all communications between the QA team and developers
- Clearly outline the responsibilities of the QA and development teams along with each member within these teams
- Provide training on giving constructive and meaningful feedback
- Standardize rules for providing feedback and communicating between teams
6. Don’t shift left processes that shouldn’t be shifted
Though shift-left testing can provide lots of benefits, it can’t be applied to all types of QA activities. You can start working on test documentation and artifacts and can even conduct static testing when the product is still in development instead of waiting for a stable build. But you can’t monitor product performance and usage or conduct user acceptance and fault injection testing before the release.
Trying to conduct these checks before the release (say, in a virtual environment) will provide you with inaccurate results that you can’t use to improve your product. In fact, there’s an opposite to the shift-left approach in QA — shift-right testing — which suggests conducting some QA activities in the post-production environment.
Before going with shift-left testing, make sure to differentiate which tests you can and cannot shift to the left. You can even combine shift-left and shift-right approaches to add clarity to your QA plans.
With shift-left testing, you can reduce the time and cost of QA activities as well as improve overall product quality. But to adopt and benefit from this approach, you need to know how to implement it and which tests shouldn’t be shifted left.
At Apriorit, our QA experts carefully choose tools and activities for shift-left testing that will suit a particular project. When developing a shift-left strategy for software testing, we focus on setting high quality standards and ensuring flawless software performance.
Reach out to start improving the quality of your next project right from the start of development!