Minimizing Test Maintenance
Write tests such that each produces the same result from a given initial state without any manual intervention between runs. Unit tests must verify Single Test Conditions by executing a single code path through the System Under Test (SUT) and executing the same, exact code path each time it runs. Verifying one condition for each test helps to minimize Test Overlap and ensures we have fewer tests to maintain if we later modify the SUT. Isolating the SUT ensures that we only have to focus on code paths through a single object.
Full code coverage can be achieved by ensuring we have as many test methods as we do code paths. And Cyclomatic Complexity tells us for how many code paths we need to write tests. It also ensures we are testing a single code path when our unit tests return a Cyclomatic Complexity value of 1. This is the result of our unit tests consisting only of sequential statements that describe the expected behavior of that one code path. Absolutely no conditional or branching statements should exist within a unit test. Eager Tests must also be avoided as they are sure signs that tests are attempting to verify complex states or multiple scenarios due to lack of control of all inputs to the SUT.