Re:Still no consensus on testing private methods
by marcosdumay on Thursday March 10, 2022 @09:18AM
(#30627137)
There are plenty of non-end-to-end interfaces that are well defined so tests don't break on changes and still encapsulate complex and important code. There is somebody on this thread talking about one that calculates the costs on a contract.
Tests for those are unit tests, and fit the GP's description. And those are the best units to test, often you don't want to unit test anything else.
Of course, YMMV. For example, on some languages you must test if the data has the correct structure and the functions have the correct interface, what is best done by unit tests, and those tests will break often. Some problems are so complex that you must test intermediate steps, otherwise you will never get it right; those tests also break often, but when you need them, you need them.
Tests for those are unit tests, and fit the GP's description. And those are the best units to test, often you don't want to unit test anything else.
Of course, YMMV. For example, on some languages you must test if the data has the correct structure and the functions have the correct interface, what is best done by unit tests, and those tests will break often. Some problems are so complex that you must test intermediate steps, otherwise you will never get it right; those tests also break often, but when you need them, you need them.