Chris Dailey
Posts: 56
Nickname: mouse
Registered: Dec, 2002
|
|
Re: Unit Testing: Don't be Fooled by the Coverage Report
|
Posted: Mar 2, 2006 4:11 PM
|
|
There is another way of being fooled by code coverage; I rarely see it mentioned.
Basically, a test setup should put the test in a particular state; then a number of operations should be performed; then the state should be tested for correct results. A test should perform a set of actions that define a transition from one state to another and then verify that state.
You could write all the tests you want, get 100% coverage, and not test the resulting state of what was executed. You could then still have bad behaving code, even though you have 100% coverage.
|
|