Problems? Is your data what you think it is? | |
PerlMonks |
Re^3: TDD with Coverage Analysis. Wow.by xdg (Monsignor) |
on Aug 28, 2005 at 06:07 UTC ( [id://487221]=note: print w/replies, xml ) | Need Help?? |
I think this is a good example of the gray zone. You can do various contortions, but what are you really proving in doing so? That open can return a false value? The reasons you give may well be valid from a particular point of view (and I'm largely sympathetic to them) -- but they are really unrelated to coverage. One should force the failure and test the result if these other things are important, not because one is aiming for 100% coverage. To reinforce the point another way: one can improve the coverage metric just by removing the "or die" phrase, and letting the program blow up on its own should an error ever actually occur. This makes the program less robust and at least arguable lower quality -- but the coverage metric goes up. So coverage does not equal quality. If there's a requirement to fail an error a certain way, then by all means, write the test and generate the error -- but then one is generating the error to show that the requirement is satisfied, not to meet a coverage goal for its own sake. -xdg Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
In Section
Meditations
|
|