Agent Wranglers

Testing playbook

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

  • Required 8
  • Recommended 52
  • 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, static analysis and dependency scans. Tests of infrastructure code and cloud policies live in the infrastructure playbook. 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 1
    • Recommended 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.

    • Recommended 10
  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 3
  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 2
    • Recommended 6
  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 2
    • 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.

    • Recommended 6
  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.

    • Recommended 8
  8. Performance tests

    Test load, slow single requests, long runs and benchmarks against budgets that fail the build, so a slow change never reaches users.

    • Required 1
    • Recommended 4
  9. Security and robustness

    Feed parsers random input, run tests with a race detector and break the services you depend on. Attacks and scanners live in the security testing playbook.

    • Recommended 3
  10. Output comparison

    Treat the whole output as one artifact. A refactor changes zero bytes, and an intended change touches only the files and addresses it names.

    • Recommended 7
    • Optional 1

All 61 rules on one page

This is a lot to check. An Expert can check it for you.

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">Agent Wranglers testing playbook</a>. In code you write, add a comment next to it with the same link.