To boldly go…

One of the key metrics for test suite development is code coverage: MCDC, range and address coverage. There are two questions that need to be asked when considering coverage. First, is it mathematically and logically possible for the full range to be reached? Second, with your test cases are you covering the full range?

Dead logic

“Dead logic” references paths within your model that can never be reached, either because the “if/else conditions” are always true or always false, or because a while or for loop construct does not terminate. When dead logic is detected this should be the first priority in examination as this may be due to a design error.

You can get there, but do you?

Assuming you can demonstrate that the code is fully reachable the next step is to look at your code coverage with your requirement-based tests. Your requirements should dictate what the algorithm does, therefore if you are validating all of your requirements you should see 85% or greater code coverage. Note that there is always some “helper” code which may not be exercised by the requirements-based tests, hence the 85% floor.

If your coverage metric is lower than 85% you need to determine if you are

  • Not fully testing the requirements: Add in additional test cases to cover the missing parts
  • Have introduced additional requirements into the functionality: Either repartition the code or add additional requirements and requirement tests to the module.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.