Ian said:
TDD is more than an approach to unit testing, it is an approach to the
full design-test-code cycle.
More fundamentally, TDD is Design Methodology, Not a Testing Methodology.
It just happens to use Unit tests as its means of describing the design,
much like RUP uses UML.
Indeed, some TDD practitioners are starting to call it BDD - as in
http://www.google.co.uk/search?hl=en&q=behaviour+driven+development&btnG=Google+Search&meta=
TDD done well will give you 100% execution coverage for free.
I'd clarify that with 'TDD done *Correctly will give you 100% execution
coverage'
*Correctly = Write 1 failing Testcase,
Write only enough code to make test Pass,
Refactor to Remove Duplication,
Repeat
More commonly referred to as Red, Green, Refactor.
How good your test coverage is depends on how good you are at thinking up edge
cases to test.
Always starting with the test first, only allows for 100%.
Simple, incremental tests are the essence of good TDD.
These kind of tests are unit tests as in the TDD usage - they are stress
tests that happen to be written in the same framework as the TDD unit
tests.
However, looping over a random set of numbers isn't the best approach to
this style of testing. If the OP wants to do this style, then using one
of the various Agitating frameworks/products will give a better result.
These tools tend to use byte code manipulation to random change various
values which aren't just numbers, but anything: int, long, float,
Integer, Double, String, Boolean, boolean, introducing Nulls, etc.
See
http://www.agitar.com/