Unit Testing

This is where we test the functionality of the components unit wise. i.e. check the minimum functionality.

In here you would not have these ideally.

  • connect to databases
  • use external services
  • have anything related to API Keys or authorization
  • have any heavy compute intensive tasks

You would have mocking to mimic all the functionality we would like to avoid above.

If you give a real implementation of any immediate dependency then the test would no longer be a Unit Test but rather become a Integration Test

It is preferred that all the unit tests are isolated from each other. i.e. each task for the test shall be provided with it’s own separate instances of immediate dependencies, this allows the tests to be independent of each other

References