3 ms·
I only test public methods. These are often composed of private methods which I might pull out of a method once I get to green and I'm working on readability. A
by ollysb 14y ago
I only test public methods. These are often composed of private methods which I might pull out of a method once I get to green and I'm working on readability. A particularly common source of one line methods is to extract query methods(replace a calculated variable with an inline call to the new method). A nice side effect of only testing public methods is that if you find you don't have test coverage on the private methods you know you can delete them(because the public methods that used to use them have all been deleted).
- ngoede 14y agoIn my experience if you find yourself wanting to test a private method it probably means it is time to bud off a new class.