-4

I was asked this in an interview, I have always read about what unit tests do, but what do they not do?

Is Unit Testing worth the effort?

Any insights? Thanks!

LoveMeow
  • 3,858
  • 9
  • 44
  • 66

1 Answers1

3

"Good" unit tests are meant to test units in isolation. Period.

Thus a "real" unit test will not exercise those dependencies of your class under test - that you decided to "cut out" (using mocking/stubbing).

Of course that means that you do not test assumptions how that 3rd party API will react to your calls for example. Because you mock out that 3rd party API.

GhostCat
  • 137,827
  • 25
  • 176
  • 248