4 ms·
So many unit tests just rephrase the function you're testing -- all they check is whether or not you edited the code and test at the same time. There are some
by blasdel 18y ago
So many unit tests just rephrase the function you're testing -- all they check is whether or not you edited the code and test at the same time.
There are some tests that are unassailable -- like checking to see if the output of a sort function is sorted and whether it has pathological complexity. On the other hand, duplicating all the conditionals in the code as tests is bullshit. Mocks are even worse!
- c1sc0 18y agoAnd this is where the line between testing and documentation becomes blurry: I trust a running test more than (outdated?) documentation. So 'just rephrasing' does make sense in some cases.
- wastedbrains 18y agoThe reason rephrasing is valuable is that it stop people from taking out or removing needed cases. If there is a test and someone changes that logic, it forces them to at least realize someone else tested and wanted that logic. Then if you search through the code and no something is unnecessary you can change the logic and the test.