Bookmarks

Shift-left testing

An approach in which quality and security checks are carried out as early as possible in development — from requirements and design to the first commits — rather than just before release.

Also: shift-left, shift left, shifting left, shift-left security

checked 9 Nov

All terms

On a project timeline, testing has historically sat near the end, so “left” means “earlier”. A defect found in the requirements or in freshly written code is fixed with a single edit; the same defect after release means an incident, a rollback and a hotfix.

What moves left

This is not about testing more, but about where exactly the checks sit. In a typical pipeline they are distributed like this:

  • edits and commits — linters, static analysis, secret scanning;
  • pull request — code review, unit and integration tests, dependency scanning;
  • build — scanning of the image and of infrastructure-as-code configurations;
  • test environment — end-to-end and dynamic checks, load runs.

Acceptance testing does not go away — it remains, but stops being the first line of defence.

Four variants of the approach

Donald Firesmith of the Software Engineering Institute identifies four ways to shift testing left; in practice they overlap.

VariantEssence
Traditionalthe emphasis moves from acceptance and system tests through the UI to unit and integration tests through the API
Incrementala large system is split into several deliveries, and each type of test is repeated in every increment
Agile/DevOpsshort sprints and a pipeline turn testing into a continuous process
Model-basedexecutable models of requirements, architecture and design are verified before any code exists

Shift left in security

In security the idea became the basis of DevSecOps: the OWASP DevSecOps Guideline promotes a shift-left culture, in which security checks are built into writing and testing code so as to keep pace with CI/CD without slowing delivery down. In practice this means static analysis and scanning of dependencies and images in the pipeline, with threat modelling even earlier, at the design stage. NIST’s SP 800-218 (SSDF) describes the same principle as a set of secure development practices that can be built into any lifecycle.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • test pyramid

    The test pyramid answers the question of how many tests of each level to write; shift-left answers at which stage of the cycle to run them.

  • DASTDynamic Application Security Testing

    DAST checks a running application from the outside and sits at the end of the pipeline; shift-left moves checks towards the start of the cycle.

In depth in the references

where the topic is covered in detail