Testing Private Methods

A question that has befuddled many developers, including myself for a long time, is: how do I test private methods? Should I test private methods?My opinion is no. I don’t test private methods. At least not directly. I test the behavior of a class’s private methods indirectly through the class’s public methods.The reasoning has to do with the reason why private methods exist. In my mind the value of private methods is that since a private method is hidden from the outside world I can feel free to refactor the private methods at any time and in any way, knowing that I’m not going to mess up any of the code that uses my class.
Testing Private Methods #ruby #rubydeveloper #rubyonrails #testing https://rubyonrails.ba/single/testing-private-methods

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles