API smoke tests after every deploy

A deploy finishes, the pipeline is green, and twenty minutes later a customer reports that checkout is broken. The pipeline was green because it tested the code before it shipped, not the system after. A smoke test closes that gap: a handful of real requests against the environment you just deployed to, run automatically, seconds after the deploy.

What belongs in a smoke test

A smoke test answers one question: is the thing basically working? It's not a regression suite. Keep it to 5–15 requests that:

  • Touch every critical dependency once. Database, cache, queue, search, the payment provider's sandbox.
  • Follow the money. Login, the main read path, the main write path.
  • Are safe to repeat. Read-only in production, or creating clearly marked test data that's cleaned up.
  • Finish in under a minute. If it's slow, people stop waiting for it.

Put them in a Smoke folder of the collection you already have, so they share auth, variables and environments with everything else.

Checks that mean something

A 200 isn't enough. A smoke check should fail if the service is up but useless:

JavaScript
pm.test('search returns results', () => {
  pm.expect(pm.response.code).to.equal(200);
  pm.expect(pm.response.json().items).to.not.be.empty;
});

pm.test('version matches the release', () => {
  pm.expect(pm.response.json().version).to.equal(pm.environment.get('expectedVersion'));
});

Run it right after the deploy

In GitHub Actions, as a job that depends on the deploy job:

YAML
smoke:
  needs: deploy
  runs-on: ubuntu-latest
  steps:
    - uses: actions/setup-node@v4
      with:
        node-version: 22
    - run: npm install -g @requestarium/cli
    - env:
        REQUESTARIUM_TOKEN: ${{ secrets.REQUESTARIUM_TOKEN }}
      run: |
        requestarium run-collection "Orders API" --folder Smoke --env Production \
          --var expectedVersion=${{ github.sha }} --bail --retries 3 --save-run
  • --bail stops at the first failure: you want to know now, not after 14 more timeouts.
  • --retries 3 absorbs the few seconds of 502/503 while a load balancer shifts traffic, with backoff. A 500 is never retried, so real errors still fail.
  • --var expectedVersion=… passes the release identifier in for the version check.
  • --save-run records the run with the commit, so the release history shows which deploy was verified.

The same pattern works in GitLab CI, Jenkins, Azure Pipelines and the rest.

Make a failure impossible to miss

  • Fail the pipeline. The CLI exits with code 1, so the deploy pipeline goes red.
  • Open an issue. --jira-on-failure OPS files a Jira issue with the failed requests and the commit. See File Jira issues when API tests fail.
  • Roll back automatically if your platform supports it: make the rollback step run when the smoke job fails.
Details of a failed run with the failed request, branch and commit
A failed run shows the request, the commit and the CI job at a glance

Smoke, then regression

A good order after a deploy to staging:

  1. Smoke (--folder Smoke --bail), under a minute.
  2. Full collection with a p95 budget, a few minutes.
  3. Promote to production only if both pass, then run Smoke again against production.