Skip to content

Shift-left and shift-right testing: where tests belong in the process

B2Bnetwork team · · 6 min

Testing and quality

In brief

Shift-left means moving testing to earlier stages: requirement reviews, tests on every code change, API contracts before integration. Shift-right means checking software once it is in production: gradual releases, feature flags, synthetic monitoring and observing real user behavior. The two approaches complement each other. Shift-left catches defects before they become expensive, and shift-right catches what no test environment can reproduce: real traffic, real data and real configuration.

What the two terms mean

The "left and right" axis is the timeline of software development: ideas and requirements on the left, production on the right. The ISTQB Foundation Level 4.0 syllabus describes the shift-left approach as performing testing earlier in the software development lifecycle, for example by reviewing specifications, writing test cases before the code, continuous integration with fast tests, and static analysis.

Shift-leftShift-right
Whenbefore and during codingafter deployment to production
Goalfind a defect before it moves onconfirm behavior under real conditions
Examplesrequirement reviews, unit and API tests on every change, contract testsreleasing to part of the traffic, feature flags, synthetic monitoring
Whoanalyst, developer, test engineerproduct team, SRE, test engineer
What it measuresdefects found before a change is mergedchange failure rate, time to restore service

Shift-left in practice

Shifting left does not mean developers simply write more unit tests. The point is to catch each kind of defect at the earliest stage where it can be seen.

  1. Requirement reviews with a tester. Questions like "what if the customer has two addresses?" or "what is the amount limit?" cost a conversation before coding. Asked after a release, they cost a fix, a regression run and a deployment.
  2. Examples as acceptance criteria. Concrete cases with input data and an expected result, written before implementation, later become automated tests. This style is described in BDD and acceptance testing.
  3. Static analysis and code review on every change, before the code reaches the main branch.
  4. API and contract tests on every change, with stubs for dependent systems, rather than once per release on a shared environment.
  5. An on-demand environment per branch, so a test engineer can check a change before it is merged.

Shift-right in practice

A test environment always differs from production: data, traffic, configuration, versions of dependent systems. Shift-right accepts this openly and adds control after deployment.

  • Gradual release (canary). The new version first gets a small percentage of traffic, and the decision to continue depends on comparing its indicators with the current version. Google's SRE Workbook describes this as a partial and time-limited deployment of a change combined with its evaluation.
  • Feature flags. The code is in production, but the feature is switched on for a chosen group, such as company employees or one branch. Switching it off does not need a deployment, as described in feature flags.
  • Synthetic monitoring. A script runs a short path in production every few minutes (login, search, a cart without payment) and raises an alarm when something stops working, before customers report it.
  • Observability. Logs, metrics and request traces show where the new version behaves differently. A common standard for this data is covered in OpenTelemetry.
  • An incident becomes a new test. Every defect found in production gets a test at the earliest stage that could have caught it. This is how shift-right feeds shift-left.

The map: where each test belongs

The table below is an example layout for a web application with an API and a few integrations. Each stage has a time limit, because the team starts bypassing a stage that is too slow.

StageTestsDurationWho responds to a failure
Requirementsreview, examples, risk assessmenta meetinganalyst and product owner
Change on a branchstatic analysis, unit tests, API tests with stubs, contractsup to 10 minutesthe author of the change
Before mergebranch environment, exploratory testing of the change, visual testsup to an hourauthor and test engineer
Test environmentintegration tests, a few E2E scenarios, performance for risky changesnightlythe team
Releasegradual release, smoke tests in productionminuteson-call team
Productionsynthetic monitoring, alerts on business indicatorscontinuouson-call team

The proportions between test levels are described in the test pyramid. The map adds when each level runs.

Limits: where shift-right stops

In banking, insurance or payments, you do not try out a new interest calculation on customers and wait for complaints. There, shift-right is limited to what does not change money or customer data: rollout to employees, control transactions on technical accounts, and running the new and old versions in parallel with the old one still making the decision. The full set of tests before release remains mandatory.

Shift-left has its traps too. Handing testing "to the developers" without test engineers usually ends with hundreds of unit tests that check implementation details rather than behavior. The number of tests grows, and defects still reach production.

How to start

A sensible plan for the first quarter:

  1. Review production defects from recent months and identify for each the stage where it could have been caught.
  2. Add a test engineer to requirement reviews before the sprint.
  3. Run API tests on every change and set a time limit for that stage.
  4. Introduce one low-risk shift-right mechanism, such as synthetic monitoring of a key path.
  5. Measure the change failure rate and the time to restore service before and after the change.

How to fit this into a two-week rhythm is covered in testing in Scrum. At B2Bnetwork we build test automation connected to the CI/CD pipeline so that every stage has its tests and an owner for a red result.

Questions and answers

Does shift-left mean testers are no longer needed?

No. Their work changes: less manual execution at the end, more requirement reviews, test design, automation and exploratory testing of changes before they reach the main branch. Teams without test engineers usually have many unit tests and few tests that check the system's behavior from the customer's point of view.

Is shift-right testing on customers?

Not in the sense of pushing testing onto customers. A feature still goes through full testing before release. Shift-right adds control over what a test environment cannot reproduce and limits the impact of a defect: a small share of traffic, a quick switch-off with a flag, an alarm before customers notice. It is an extra safety net, not a replacement for testing.

How do you measure whether shifting tests works?

Compare indicators before and after: the share of deployments that cause a failure or need a fix, the time to restore service, the number of defects found in production and the time from change to deployment. A breakdown of defects by the stage where they were found also helps. A successful shift-left moves that distribution to the left.

Does shift-right fit regulated systems?

In a limited form, yes. Rollout to employees, control transactions on technical accounts, synthetic monitoring and running the old and new versions in parallel do not change anything for customers. A gradual release to customers needs a risk and compliance assessment, and features that affect money or decisions about customers go through full testing before release.

What it looks like in a project

Planning testing for your project? Talk to a test manager.

Let's talk

Read more: Testing and quality

All in Testing and quality →