Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You have some tests to ensure your public methods don't change implementation.

That isn't the purpose of all tests.

A complex public API should consist of smaller private parts. When you change those smaller parts of code, you would like to know if you break something and specifically what you broke. Testing of a small, isolated chunk of code is the 'unit' in the term 'unit tests'.

Unit tests on actual units of code allow you to more quickly isolate failures.



I test all public methods. Anything private is part of the implementation for those metods, and rarely would I want to test that. If I make a breaking change in a private method, and the public unittest does not test it, it's an edge case I didn't test for, or the public method is too broad.


The public implementation consists of smaller private parts.

If the public test fails, how do you know what specific part of the public implementation was responsible for the change?


I don't and that is not why I'm testing either. I'm testing so the contract (i.e. public methods) other developers rely on does not change. That said, I can see in the build history what checkin caused the test to fail, so I would still know where to look.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: