DEV Community

Discussion on: Do you unit test private methods?

Collapse
 
szymach profile image
Piotr Szymaszek

The way I was taught and agree with, private methods should be invisible to tests. Tests should check things that can be publicly accessed and by providing different input data you should cover all (or at least feasible) angles with them. If you need to have that private method tested specifically, why not extract it and unit test it then?