Hacker News new | ask | show | jobs
by ori_b 3825 days ago
Generally, I see a lot of testing of internal functions, which often should change their contract as refactoring happens.

All too rarely do I see people focusing testing on public APIs.

1 comments

It depends on your definition of "internal". I write unit tests at whatever boundary that makes sense, and I certainly will write unit tests to test contracts between related pieces that others might call "internal." But then I can refactor trivially at that level, which I may (read: usually do) want to have available later.

I don't generally write, nor really see, see a lot of internal contractual testing in unit testing (not least because it becomes very hard to do so if you actually use visibility in OOP).