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

I think this is what OP is saying, you need _both_ unit and integration tests.

In unit specs you should use mocks/fakes for external behaviour. Then you can simply verify that it's calling the dependency correctly.

Isolation specs are useful because when integration tests fail, they usually give little feedback as to what exactly went wrong in the system.

Also integration specs are expensive and slow to run since they execute everything.

Finally I think mocks/fakes are useful because if you find yourself mocking 20 objects to get a single unit test working, then it's a sign that you need to redesign the code.



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

Search: