Chapter 1 of 10All chapters
Chapter 1 of 10
Why test
Confidence to change things.
The real benefit
Tests catch some bugs, but their main value is permission to change code without fear. A codebase nobody dares refactor decays whatever its original quality.
- A test is also documentation of intent that cannot go out of date silently.
- Writing one often exposes an awkward design before the code ships.
What not to test
Testing the language, the framework or trivial getters produces noise that hides the tests that matter. Test your own decisions and behaviour that would be expensive to get wrong.