In 30 seconds
- Automated tests give fast, repeatable feedback on every change.
- Balance many fast unit tests with fewer slow end-to-end tests.
- They make continuous integration and delivery possible.
The test pyramid
| Layer | Amount | Speed |
|---|---|---|
| End-to-end tests | Few | Slow |
| Integration tests | Some | Medium |
| Unit tests | Many | Fast |
Mike Cohn popularized the pyramid in Succeeding with Agile. See unit, integration and end-to-end testing.
What to automate first
- Core business rules and calculations
- Bugs that escaped before, so they can't return
- The main happy paths users rely on
Keeping the suite healthy
- Fix or delete flaky tests quickly
- Keep the full run fast enough to use on every commit
- Add tests to the Definition of Done
Myth vs reality
Myth · Automation replaces testers.
Reality · Testers shift to exploration and test design.
Myth · 100% coverage means bug-free.
Reality · Coverage shows what ran, not what was checked.
Myth · UI tests are the most valuable.
Reality · They're slow and brittle; most value comes lower down.
The AI angle
AI can write tests quickly, but tests generated from the code can confirm its bugs. Write or check tests against the spec, and keep a human deciding what matters to test.
FAQ
How fast should tests be?
Unit tests in seconds; the full suite ideally within minutes.
What's a flaky test?
One that passes or fails randomly without code changes.
Should we automate manual test scripts?
Selectively; redesign them for automation first.