3 ms·
IMO testing's biggest strength is in allowing you to delegate remembering all the use cases of an API to some code, instead of having to look them up in a check
by lubonay 11y ago
IMO testing's biggest strength is in allowing you to delegate remembering all the use cases of an API to some code, instead of having to look them up in a checklist, or worse, having to remember them all.
Even if the tests are covering mundane, easy functions and execution paths, the benefit of not worrying if you broke something far outweighs the time to write tests.
- Fradow 11y agoIsn't "remembering use cases" something that should be done with comments or documentation ?
- jacques_chester 11y agoComments and documentation become stale because they require deliberate human intervention to maintain their truthfulness. They also rely on the author of the documentation or comments correctly mentally executing the code being marked up. Tests are compared with the API every time they're run, as seen by the computer's model of execution, giving immediate feedback on detected discrepancies. (I believe that Pythonistas have clever docs that can encode snippets of testing into documentation, which splits the difference a bit, but is no substitute for a robust test suite).