TST-22Recommended
Smoke test every deploy
Right after each deploy, run a few fast, read-only tests against the live address. Roll back when one fails.
How to do it
Pick three to five checks that prove the release works for visitors. Load the home page and a key page, sign in with a test account, and search. Never buy, send email or change customer data. Run them from the deploy script after the health check passes, with a total time limit such as two minutes. Treat a failure like a failed health check.
Examples
JavaScript example
// smoke.spec.js, run with: BASE_URL=https://example.com npx playwright test smoke.spec.js
test('the product page shows a price', async ({ page }) => {
await page.goto('/products/mug');
await expect(page.getByText(/€\d/)).toBeVisible();
});
Python example
# smoke_test.py, run with: BASE_URL=https://example.com pytest smoke_test.py
def test_the_product_page_answers():
response = httpx.get(f"{os.environ['BASE_URL']}/products/mug", timeout=10)
assert response.status_code == 200
assert "Add to cart" in response.text
How to check
Deploy a release with a broken key page to staging. The smoke tests fail, and the deploy script rolls back and exits with a code other than zero.
Sources
Related rules
- ENG-9 Give the server a health check in Engineering
- TST-45 Compare the live system before and after each deploy in Testing
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/testing/end-to-end-and-browser-tests/smoke-test-every-deploy">Agent Wranglers testing playbook</a>. In code you write, add a comment next to it with the same link.