Why Test Software? Too Long, Didn't Read Summary
Last updated:
- If you didn't test the code, you don't know if it works
- If there are no tests, you can't refactor the code
- Tests are documentation (for humans and AI)
See all posts related to testing here: Entries by Tag: testing
Minimum Viable Post (MVP
) to send to your colleague who isn't sure whether tests are really needed.
If you didn't test the code, you don't know if it works
As simple as that. If it's not tested, you don't know if it works. You should assume it doesn't!
Yes, this still holds in those cases where you think "This piece of logic is so simple, there's no need to test it." Well, yeah, there is.
If there are no tests, you can't refactor the code
If there are no tests (unit, integration, etc) for some piece of logic, nobody can refactor the source code and be confident that it still works.
If nobody can refactor the code, it will gain entropy and eventually become unmanageable.
Tests are documentation (for humans and AI)
Especially for complex logic, it's often hard to understand what exactly how or why some piece of code works.
Tests instantiate a piece of code with an actual use case, and that makes its intent and purpose clearer.