Why Developer Testing?
As any developer knows, even software which seems simple from the outside can be complex on the inside, made up of many moving parts, components and layers. Just like a house built on poor foundations or with below standard materials, if the inside is weak then the problems eventually show on the outside.
That is the case for developer testing. It is not a ceremony that exists to satisfy a process document. It is the mechanism by which we keep a growing system from collapsing under its own weight.
Tests are a design tool
Writing a test before the code forces you to think about the interface from the outside. What does this component need to do? What does a caller need to provide? What should happen when something goes wrong? Those questions are much easier to answer when the code is small and the test is the first user.
Test driven development takes this further. The test becomes a description of the behaviour you want, and the implementation grows to satisfy it. The result is code that is easier to call, easier to change and easier to explain to the next person.
Tests are a safety net
Most of the cost of software comes after the first release. Features are added, dependencies change and people move between teams. A good automated test suite gives the next developer the confidence to make a change without breaking something they cannot see.
The key word is good. A large suite of fragile tests can be worse than no tests at all, because it slows everyone down and trains them to ignore failures. Tests should be fast, deterministic and focused on behaviour rather than implementation detail. When a test fails, the team should learn something useful.
Tests are part of delivery
Continuous delivery depends on confidence. If every release requires a long manual regression pass, the team will not release often, and the feedback loop will stay slow. Automated tests are what make frequent releases possible without turning them into a gamble.
That does not mean every change needs a hundred tests. It means the team should be deliberate about the risks that matter and cover those with the cheapest test that gives real confidence. A small number of well chosen tests at the right level is worth more than a huge suite that nobody trusts.
For the build side, see CI tools and tips on continuous delivery. For the wider quality argument, read internal versus external code quality. Martin Fowler's test pyramid is a useful model for choosing the level of each test.
Reference shelf
Sources and further reading for this note.
- The test pyramidA model for choosing test levels.Opens in a new tab
- Test driven developmentThe practice in context.Opens in a new tab
- Unit testingA plain introduction.Opens in a new tab
- Acceptance testingTesting against the user's view.Opens in a new tab
- JUnit 5The testing library for Java teams.Opens in a new tab
- Selenium documentationBrowser automation for acceptance tests.Opens in a new tab