Back To Blogs

Shift-Left Testing in CI/CD: Which Tests Belong Where in the Pipeline

"Shift left" means finding problems earlier, when they're cheaper and faster to fix. In a CI/CD pipeline, that means putting each kind of test at the stage where it gives the most useful feedback for its cost.

The pipeline, stage by stage

0. Before code: requirements and design

The earliest testing is reviewing requirements. Testers ask:

  • What happens with empty, maximum and invalid inputs?
  • What if the user does this twice? Out of order? In two tabs?
  • How will we know it works? (acceptance criteria)

A question asked in refinement costs minutes; the same gap found in production costs days.

1. On the developer's machine (seconds)

  • Linting and formatting
  • Type checking
  • Fast unit tests for the code being changed

Pre-commit hooks can run the quickest of these.

2. On every pull request (minutes)

  • The full unit test suite
  • Integration tests (database, API layer) in isolated containers
  • Static analysis and dependency vulnerability scans
  • A small set of end-to-end tests for critical paths
  • Build and package

Goal: a reviewer sees green or red within about 10–15 minutes. Slow PR pipelines get bypassed.

3. After merge, in a test or staging environment (minutes to an hour)

  • Deploy automatically
  • Smoke tests gate everything else (smoke vs sanity vs regression)
  • The broader end-to-end regression suite, run in parallel
  • API contract tests between services
  • Accessibility and visual checks on key pages
  • Exploratory testing of new features by testers

4. Before release (as needed)

  • Performance tests for changes that affect load or critical paths (basics)
  • Security scans (dynamic scanning of a running app)
  • User acceptance where required

5. In production (continuously)

  • A post-deploy smoke test
  • Monitoring and alerts: error rates, latency, business metrics (orders per minute, sign-ups)
  • Feature flags and canary releases to limit how many users a bad change can reach
  • Fast rollback

Testing doesn't stop at deployment; observability is the last line of defence.

The test pyramid, adapted

  • Many unit tests: fast, precise, cheap
  • A healthy layer of integration and API tests: catch most business-logic bugs at moderate cost
  • Fewer end-to-end UI tests: only for critical user journeys
  • Exploratory testing alongside all of it, where humans add the most value

If your suite looks like an ice-cream cone (mostly slow UI tests), move checks down to the API and unit levels.

Making it work

  • Fast feedback first: order stages so the cheapest, most likely failures run first
  • Zero tolerance for flaky gates: a flaky blocking test trains people to ignore failures (fixing flaky tests)
  • Tests as part of "done": a feature isn't finished until its tests are in the pipeline
  • Shared ownership: developers write unit and integration tests; testers lead on strategy, risk, end-to-end and exploratory work
  • Visible results: reports and trends on a dashboard, not buried in logs

The tester's role in a shift-left team

Testers become quality coaches: reviewing stories for testability, pairing with developers on test design, curating the end-to-end suite, and exploring the risky edges that automation misses. Technical skill matters, but so does test thinking: boundaries, state, risk, and the bugs that live between components.

Build both skill sets

Keep your test-design thinking sharp in QAUnlocked Practice Labs, where every planted bug is a case for "which pipeline stage should have caught this?", and test your automation and DevOps knowledge in timed battles.

CI/CDshift-leftDevOpstest pyramidcontinuous testing

Comments

0 Comments

Be the first to comment.