Agent Wranglers

Testing playbook

Rules for tests that catch bugs, run fast and never cry wolf. Strategy, unit, integration, browser, data, flaky tests and test quality.

  • Required 18
  • Recommended 14
  • Optional 1

A testing playbook for any language and any kind of software. It covers what to test, how to write each kind of test, and where test data comes from. It also shows how to keep the suite fast and trustworthy.

AI agents write code faster than people can read it. Tests are how you know that code still does what it should. A good suite fails for bugs only, and it says exactly what broke.

The clean code and architecture playbook covers how to design code that is easy to change. The security testing playbook covers attacks. This playbook covers everything in between.

Chapters

  1. Test strategy

    Decide what to test before writing tests. Spend the effort where bugs would hurt most, keep most tests small, and ship every change with its tests.

    • Required 3
  2. Unit tests

    Small tests for rules and calculations. They test behaviour through public functions, run in milliseconds, and give the same result every time.

    • Required 3
    • Recommended 2
  3. Integration and contract tests

    Test how your code works with a database, queue or service. Run dependencies in containers, and contract tests between services you own.

    • Required 2
    • Recommended 1
    • Optional 1
  4. End-to-end and browser tests

    Drive the app the way a person does, through a few journeys that matter. Find elements by role and label, wait for state, and never sleep.

    • Required 4
    • Recommended 1
  5. Test data and environments

    Build test data in code, give each test its own, and test on an environment that matches production. Never copy personal data into tests.

    • Required 1
    • Recommended 2
  6. Flaky and slow tests

    A test that fails at random teaches people to ignore red builds. Find flaky tests early, quarantine them with an owner, and keep the suite fast.

    • Required 1
    • Recommended 3
  7. Test quality

    Prove the tests would catch a bug. Use mutation testing, treat coverage as a floor, and review test code as carefully as the code it checks.

    • Required 2
    • Recommended 3
  8. Non-functional tests

    Test load, accessibility, AI answers and parsers too, with budgets and scores that fail the build. These bugs reach users just as surely as broken features.

    • Required 2
    • Recommended 2

All 33 rules on one page

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers testing playbook: https://agentwranglers.se/playbook/testing.