Hacker News new | ask | show | jobs
by moss 5952 days ago
It sounds like your philosophy of testing is about what mine was a year ago. Since then, I think I've modified it in two big ways:

1) I've found that potential bugs, and design problems, are often easier to spot at a lower level. Because of this, I've started using more integration-y tests to build out my initial implementation, and more unit-y tests to fill out additional details.

2) I've found the GOOD use of mock objects: when I have a class that wants to expose its data by calling a method on a narrow, well-defined interface, rather than by providing it through a getter, I'm happy using a mock version of that interface.

I wouldn't advocate it as The One True Testing Dogma, but I thought I'd share it in case you find it useful.

1 comments

This made me curious, could you expand on what you mean with 2?