1

Let's say that I have a software component A (function, class, react component, etc.) that uses three other software components B, C, D.

If I try to test fully test A (without mocks!), then I would have to basically implement (unit) tests for components A, B and C.

My question is: should I use:

  • Integration Tests without mocking
  • Integration Tests with mocking + unit tests

Any related resources are welcomed. Thanks in advance for your time!

1

The way I see it is that integration tests are actually about integrating real stuff, not mocking.

It makes sense to mock other components in your unit tests, because you are focused on your component you're implementing, so you want to filter out yet another complexity in the form of those other components, or those other components might not be implemented yet.

Therefore, I'd go for this approach:

  • unit tests with mocks
  • integration tests without mocks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.