What it is
Programs that check another program: they feed it input and compare the result with what is expected. They run in seconds before every release, so a broken feature never reaches customers.
How we use it
We test what is most expensive to break: payments, lead forms, bot replies, edge cases like an empty field or a huge number. Tests run before every deployment.
Where automated tests help a business
- The site takes payments or leads, and a broken form means lost money that nobody notices right away.
- The project keeps evolving, and every change can break something that used to work.
- More than one person works on the code, or the project is moving to another developer.
How we use it
- Test what is expensive. Payments, lead forms, bot replies, calculations: the things that cost the most to break.
- Check the edges. An empty field, a huge number, an unexpected character, a form sent twice. Bugs tend to live there rather than in typical data. For what an unchecked edge can do, see integer overflow.
- Run before release. Tests run before a new version reaches the server. A red test means the version does not ship.
- A new bug gets a new test. We first reproduce a bug with a test and then fix it, so it cannot come back.
The chat assistant on this site, for example, is checked by more than a hundred tests, from recognising questions about our products to a neural network's answer breaking off mid-sentence.
Common problems
- Tests for the sake of coverage. A hundred tests for trivial functions and not one for payments.
- Tests nobody runs. If the test run is not built into the release process, tests get forgotten.
- Brittle tests. They break on any layout change and only get in the way. Test behaviour, not implementation details.