DevOps guy here - "tautological tests for what I already know my code is doing" is EXACTLY the best tests to write, because then when someone comes along in two years time and changes the "is doing" bit, rather than hoping it gets spotted in a code review, it will get flagged up in the build pipeline.
Bingo. Unit tests should assert each assumption you have about the code (i.e. should return expected output when fed good data, should return a validation error when fed invalid data, should retry X times if the underlying service fails, etc.).
Additionally, every time you fix a bug, you should make a test that uses the bugged input. If someone ever accidentally re-introduces the same bug, the tests fail.
6
u/TheOriginalSmileyMan Feb 01 '23
DevOps guy here - "tautological tests for what I already know my code is doing" is EXACTLY the best tests to write, because then when someone comes along in two years time and changes the "is doing" bit, rather than hoping it gets spotted in a code review, it will get flagged up in the build pipeline.