Function Coverage

What's the Idea?

  • Partition the input domain automatically based on features of the source code.

How do you measure success?

  • Function Coverage is successful if every Function in SUT is executed during testing.
  • \[Test Coverage Metric \gets \frac{functions covered}{total number of functions}\]

What if you get less than 100% coverage?

  • Re-factor old and create new tests to cover the missing functions

What if you can't get 100% coverage?

Two possibilities:
  • The code is dead (never used)
  • You don't understand the system well enough

What are the drawbacks to this method?

  • Tests are based on code, not requirements -- they can't tell you if you're missing something
  • 100% has a clear meaning, anything less is up to judgement -- what's good enough?
  • Most systems are too complex to get 100% Coverage
  • Just because you've tested a function doesn't mean that you've tested all the code inside of it completely
From Udacity's Software Testing Unit 2