Documentation and comments get stale. Tests don't.
I'm sure you've seen code comments that say the code will do something when, in fact, it does something different.
Or documentation that has become outdated and stale and no longer correct.
Automated tests and other tools, such as static analysis, are executable documentation, so they can't become stale.
If the implementation code changes and no longer matches the tests, the tests will fail, and either the implementation or test can be updated.
Then, if you need to refer to the test, as long as it's passing, you know what it shows is still applicable.
The same can't be said for markdown files, Confluence pages, Word documents or other static documentation.
- Oliver
Was this interesting?
About me
I'm an Acquia-certified Drupal Triple Expert with 17 years of experience, an open-source software maintainer and Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.