Re: c# 2004 (Whidbey)
Hi Jon,
I quite agree that there is no silver bullet. Unit tests on their own,
whether manual or automated, won't find all of your bugs. Nor will stepping
through your code, or performing code inspections. Each of these techniques
on their own will find a specific set of bugs, but only by combining all of
them together can you have some confidence in your code.
My criticism is that Niall's attitude puts all the emphasis on unit tests
backed by code coverage, and this simply doesn't work in isolation.
Here are a couple of papers that I found useful in clarifying my thinking
when doing research for my book. The first looks at subtleties in using code
coverage tools, the second looks at problems with unit test automation.
Mark
--
Author of "Comprehens ive VB .NET Debugging"
"Jon Skeet" <skeet@pobox.co m> wrote in message
news:MPG.19a6a4 357ca4ed9a98a31 4@news.microsof t.com...
Mark Pearce <evil@bay.com > wrote:[color=blue]
> In addition, code coverage tools used to verify your unit tests are not[/color]
very[color=blue]
> useful. They can't identify what the code should be doing, or what it[/color]
isn't[color=blue]
> doing. But developers tend to use these tools to say "But there can't be a
> bug: my unit tests are infallible and my code coverage tool verified that
> all paths have been executed".[/color]
This is a straw man. Clearly anyone who, when presented with a problem
says that it can't be in their code because their unit tests are
infallible is crazy. I could present the other straw man, the developer
who says "But there can't be a bug: I've walked through all the code
and it did what it should."
When presented with a problem, you verify that it really *is* a
problem, write a unit test which shows that it's a problem (and check
that that unit test fails on the current code), then fix the code and
check that the unit test now passes.
--
Jon Skeet - <skeet@pobox.co m>
If replying to the group, please do not mail me too
Hi Jon,
I quite agree that there is no silver bullet. Unit tests on their own,
whether manual or automated, won't find all of your bugs. Nor will stepping
through your code, or performing code inspections. Each of these techniques
on their own will find a specific set of bugs, but only by combining all of
them together can you have some confidence in your code.
My criticism is that Niall's attitude puts all the emphasis on unit tests
backed by code coverage, and this simply doesn't work in isolation.
Here are a couple of papers that I found useful in clarifying my thinking
when doing research for my book. The first looks at subtleties in using code
coverage tools, the second looks at problems with unit test automation.
Mark
--
Author of "Comprehens ive VB .NET Debugging"
"Jon Skeet" <skeet@pobox.co m> wrote in message
news:MPG.19a6a4 357ca4ed9a98a31 4@news.microsof t.com...
Mark Pearce <evil@bay.com > wrote:[color=blue]
> In addition, code coverage tools used to verify your unit tests are not[/color]
very[color=blue]
> useful. They can't identify what the code should be doing, or what it[/color]
isn't[color=blue]
> doing. But developers tend to use these tools to say "But there can't be a
> bug: my unit tests are infallible and my code coverage tool verified that
> all paths have been executed".[/color]
This is a straw man. Clearly anyone who, when presented with a problem
says that it can't be in their code because their unit tests are
infallible is crazy. I could present the other straw man, the developer
who says "But there can't be a bug: I've walked through all the code
and it did what it should."
When presented with a problem, you verify that it really *is* a
problem, write a unit test which shows that it's a problem (and check
that that unit test fails on the current code), then fix the code and
check that the unit test now passes.
--
Jon Skeet - <skeet@pobox.co m>
If replying to the group, please do not mail me too
Comment