News for hackers. Stuff that matters.
Re:The maintainability of unit tests by j_baker on Thursday February 25, 2010 @11:40AM (#1150954)
I would argue that this type of code in most cases isn't a good candidate for unit testing. Typically, dependency-heavy code is better tested via integration tests.

The problem with mocking that I've run into is that you're not really testing expected functionality. You're testing that code calls an API. This sounds good in theory until you need to change the API. Then, you have a whole bunch of tests to clean up.

Re:The maintainability of unit tests by brown9-2 on Thursday February 25, 2010 @12:54PM (#1151106)
I prefer to think of it as testing how you code behaves when the API returns x, y, or z.

It can be a pain to change the mocks and tests when the API changes, but what else can you do - not test this layer of your code?

Re:The maintainability of unit tests by j_baker on Thursday February 25, 2010 @02:38PM (#1151398)
Just because you don't unit test something doesn't mean you can't test it. This is what integration tests exist for.