Keep It Simple: Remove Code

You can simplify your tests and reduce your testing burden by deleting code. If the code does not exist, you neither have to test it nor have to maintain it. Remove unused code, commented code, code that does more than it needs to, and code that is more complex than it needs to be. Deleting code is a great way to reduce your costs.

Also, remove redundant tests. Even better, do not write them to begin with. Extra tests do not add to your validation, but they take time to run and attention to maintain. Just imagine how much time could be wasted trying to figure out what makes the redundant test different from the other tests in the same area.

If you use code coverage to guide your testing, removing code also increases your coverage. We usually think of increasing coverage by increasing the number of tests. But coverage is a percentage computed by dividing the number of features4 exercised by the number of features that exist. We have two degrees of freedom to control the coverage, including reducing the total number of features. In the case of redundant tests, your coverage will not increase but it will not decrease, either.

4. I refer to “features” here because coverage is not just about lines or statements. A thorough testing regimen may also consider branches, conditions, loop iterations, def-use chains, or other measurable features of the code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.190.175