---
title: "Testing playbook · Agent Wranglers"
url: https://agentwranglers.se/playbook/testing
updated: 2026-10-20
licence: "All rights reserved"
---

# Testing playbook

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

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](https://agentwranglers.se/playbook/architecture) covers how to design code that is easy to change. The [security testing playbook](https://agentwranglers.se/playbook/adversarial-testing) covers attacks. This playbook covers everything in between.

**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`.

## Chapters

1. [Test strategy](https://agentwranglers.se/playbook/testing/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. (3 required)
2. [Unit tests](https://agentwranglers.se/playbook/testing/unit-tests): Small tests for rules and calculations. They test behaviour through public functions, run in milliseconds, and give the same result every time. (3 required, 2 recommended)
3. [Integration and contract tests](https://agentwranglers.se/playbook/testing/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. (2 required, 1 recommended, 1 optional)
4. [End-to-end and browser tests](https://agentwranglers.se/playbook/testing/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. (4 required, 1 recommended)
5. [Test data and environments](https://agentwranglers.se/playbook/testing/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. (1 required, 2 recommended)
6. [Flaky and slow tests](https://agentwranglers.se/playbook/testing/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. (1 required, 3 recommended)
7. [Test quality](https://agentwranglers.se/playbook/testing/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. (2 required, 3 recommended)
8. [Non-functional tests](https://agentwranglers.se/playbook/testing/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. (2 required, 2 recommended)

See all 33 rules on one page in the [checklist](https://agentwranglers.se/playbook/testing/checklist).
