4 ms·
In instances where I needed to test private methods, the aim was to provide extra feedback to the failure of a higher-level public method/s that by themselves d
by wakeupcall 5y ago
In instances where I needed to test private methods, the aim was to provide extra feedback to the failure of a higher-level public method/s that by themselves do not provide enough feedback to pinpoint the issue.
It answers the question "what failed?" on a deeper level. Something you'll need to know when the public-method test fails anyway.
It's rarely needed on proper API designs (in general such scenarios can be split into a separately-testable object which is not by itself exposed), but it's not too uncommon in my experience.
In such cases, all the solutions to test private methods pretty much suck.