4 ms·
> I've come to believe that sometimes it _is_ worth unit testing other people's code, counter to the popular advice. The popular advice is that you shouldn't t
by randomdata 2y ago
> I've come to believe that sometimes it _is_ worth unit testing other people's code, counter to the popular advice.
The popular advice is that you shouldn't test implementation, only interface behaviour. Which means that you shouldn't explicitly test the usage of someone else's code within your code. Their code is just an implementation detail. If the implementation is faulty, testing of the interface should still reveal that faulty behaviour.
That doesn't necessarily mean you shouldn't ever test someone else's code (with their interfaces). But if someone else's code is not tested it is undefined, and relying on undefined behaviour is fraught with problems. It is unlikely you would want to use it in the first place, which, practically speaking, leaves little justification to invest in improving the situation.