What to test at each stage of CI/CD

What to test on a pull request, after a merge, after a deploy and on a schedule, how deep each should go, and when a test should be allowed to block a release.

Checked 24 November 20264 min read

Testing everything at every step is slow, and testing only at the end finds problems after your users do. The answer is a different depth at each stage: fast and narrow where people are waiting, wide and thorough where nobody is. This works the same in GitHub Actions, GitLab, CircleCI, Bitbucket, Vercel or any other pipeline.

The four stages at a glance

StageWhat it testsHow deepBlocks?
Pull requestthe preview of that changethe pages and flows it touches, on the fastest devicesnot at first
Mergethe staging copy of mainevery page and flow, every devicenot at first
Deploythe live site, right after it changesthe key flows first, then everythingrarely: it can roll back
Scheduledthe live site between deployseverything, every daynever: it alerts

On a pull request: fast, and only what changed

Someone is waiting on this, so it should finish in minutes.

  • Test the preview deploy the pull request makes (Vercel, Netlify, Cloudflare Pages and others give each one its own address), or a local copy your CI starts.
  • Test what the change touches: the pages it edits and the flows that pass through them. A change to the checkout tests checkout, not the blog.
  • Use the fastest devices: desktop Chrome and one Android phone catch most problems. Leave the slow and old devices for later stages.
  • Post the result on the pull request, with the failing step and a screenshot, so the author sees it where they're working.

After a merge: everything, everywhere

Main has changed and nobody is waiting, so go wide.

  • Every page and every flow.
  • Every device, including the old iPhone and the cheap Android: these find the bugs the fast devices miss (see why sites break only on iPhone Safari).
  • Two changes that each passed alone can break together. This is where you find out.

After a deploy: is the live site still up?

The same code can behave differently in production: real data, real third parties, a CDN, a different configuration.

  • Run the key flows first (sign in, search, checkout, whatever your business runs on), so a broken release is found in minutes, then the rest.
  • Use production-safe flows: they read and look, and never buy, send or delete. A test account helps (see test accounts for sign-in).
  • If you can roll back in one step, a failing key flow is the time to do it.

On a schedule: between deploys

Sites break without a deploy: a certificate expires, a third-party script changes, an API starts failing, a new iOS version ships.

  • Test everything once a day, at a quiet hour.
  • Alert the team where they'll see it (Slack, Teams, email), not in a dashboard nobody opens.

When a test should block a release

A test that blocks a release has to be right almost every time. One false alarm a week, and the team learns to ignore it or turns it off.

  1. Start every stage report-only. It posts results and blocks nothing.
  2. Watch how often it's wrong. Count its false alarms (it failed, the site was fine) and its misses (it passed, the site was broken).
  3. Let it block only once it has earned it: when its false alarms are rare enough that a failure is worth stopping for.
  4. Tell a broken test from a broken site. A phone that was locked or a lab that lost its network isn't your site's failure, and shouldn't block anything (see flaky test in the glossary).

Every change keeps its tests current

Tests go stale when features change. The simplest rule that works: every change people can see adds or updates a flow that checks it, in the same pull request. A reviewer, or a check in CI, asks for it when it's missing. If your coding agent writes the change, it writes the flow too (see giving your coding agent a test loop).

With PocketQA

PocketQA runs your flows on your own real phones and browsers, from any CI: the command-line runner or the API takes a preview address and returns the result, and can comment it on the pull request. A site's flows also run on its daily check and after each deploy. Your coding agent can start a test and read the result itself.

Related guides