The Thoroughness guideline
When unit testing some naturally occurring questions are as follows:
- How many tests are enough?
- Do we have a test coverage metric?
- Should we test third-party components?
- What system components should we unit test and what should we leave?
The Thoroughness guideline attempts to set the answers to these questions.
Unit tests for dependency testing
When you encounter a dependency, whether this dependency is part of your system or a third-party dependency, you create a test double for it and isolate it in order to test your SUT.
In unit tests, you do not directly call a third-party dependency; otherwise, your code will be an integration test and with that, you lose all the benefits of unit tests. For example, in unit tests, you do not call this:
_someZipLibrary.Zip(fileSource, fileDestination);
For testing this, you create a test double for the .zip
library to avoid calling the real thing.
This is an area that unit...