Unit tests are not new. Essentially, a unit test is designed to test a feature of your system in isolation to prove that it is working as it should. The F.I.R.S.T principles of unit testingstate that unit tests should be the following:
- Fast: They should execute fast, meaning they shouldn't carry out any complex or lengthy operations.
- Isolated/independent: A unit test should not depend on other systems and should provide results independent of any specific context.
- Repeatable: A unit test should yield the same result whenever it executes if nothing is changed on the implementation.
- Self-validating: They should be self-sufficient—that is, they should not require any manual inspection or analysis.
- Thorough/timely: They should cover all the important stuff, even if not required for 100% of the code.
In a nutshell, a unit test should run fast so that we don't...