loading...

re: What "accepted truth" in software development do you find questionable? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I've never seen any recommandation that you shouldn't define unit tests for your own private functions. As soon as you have something which might f...
 

I disagree here. Your private methods are implementation details. You should only need to test the public interface to the API. If you are finding your public methods are dependent on too many various private methods it is a sign that they themselves can be broken into a class.

Your private methods are implementation details

Yes but tests are also meant to check the implementation works as intended.

If you are finding your public methods are dependent on too many various private methods it is a sign that they themselves can be broken into a class.

It's more often the opposite: a core private function, accessed through several public functions, none of them covering the whole possibilities of the function doing the real job (and the one also which may fail). In such a case, testing all the public functions adds a lot of noise and reduces the stress put on the function which matters.

Code of Conduct Report abuse