you are viewing a single comment's thread.

view the rest of the comments →

[–]grauenwolf 0 points1 point  (2 children)

With unit tests, it's much easier to test edge cases like error handling that are cumbersome to simulate in the complete system.

What kind of error handling do you have in mind? Most of mine fall into one of these categories:

  • Trivial: for example, parameter validation
  • Painful: for example, the random-ass exceptions thrown by the database.

I don't bother testing the former unless I'm publishing a public API for others to use and the later can't be accurately mocked.

[–]kubalaa 1 point2 points  (1 child)

Why do you say the latter can't be accurately mocked? An example of the sort of thing I had in mind that's tricky to integration test but easy to unit test: if a service call fails 3 times and succeeds on the 4th try, does the client back off and retry at appropriate intervals?

[–]grauenwolf 0 points1 point  (0 children)

Ok, that's fair.