---
title: "Shape the test suite like a pyramid · Agent Wranglers"
url: https://agentwranglers.se/playbook/testing/test-strategy/test-shape
updated: 2026-10-20
licence: "All rights reserved"
---

# Shape the test suite like a pyramid

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

- Level: Required
- Chapter: [Test strategy](https://agentwranglers.se/playbook/testing/test-strategy)
- Rule: Write many small, fast tests and only a few slow, wide ones. Each kind of test checks what only it can check.
- How: Unit tests cover rules and calculations. Integration tests cover how your code talks to a database or another service. Browser tests cover a few whole journeys. When a slow test only checks logic, move that check down to a unit test. Keep the whole suite under a set time, such as ten minutes. A content site with little logic of its own may have more page checks than unit tests, and that is fine.
- Check: Count tests by kind. Unit tests outnumber integration tests, which outnumber browser tests. The full suite runs in under ten minutes.

Example:

```sh
# Count tests by folder, then time the whole run
find tests/unit -name '*.test.*' | wc -l
find tests/integration -name '*.test.*' | wc -l
find tests/e2e -name '*.spec.*' | wc -l
time npm test
```

**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/test-strategy/test-shape`.

- Previous: [Test what would hurt to break](https://agentwranglers.se/playbook/testing/test-strategy/test-by-risk)
- Next: [Ship tests in the same change](https://agentwranglers.se/playbook/testing/test-strategy/tests-with-the-change)
- [Test strategy](https://agentwranglers.se/playbook/testing/test-strategy)
