Unit Tests
A unit test is a test that meets the following requirements:
• Repeatable: you can rerun the same test as many times as you want.
• Consistent: every time you run a test, you get the same result. For example, testing threads cannot be considered unit test because using threads can produce inconsistent results.
• In Memory: the test has no hard dependencies on anything not allocated in memory (such as file system, databases, or network).
• Fast: running a test should take less than half a second.
• Checking one single concern or use case in the system: when you check more than use case, identifying the issue becomes more difficult.
If you break any of these principles, you increase the chance that developers either do not trust the test results due to repeated false failures by the tests, or developers do not want to run the tests at all because of the significant amount of time that the tests require.