Code correctness, and testing strategies

Ben Finney bignose+hates-spam at benfinney.id.au
Sat May 24 21:34:01 EDT 2008


Roy Smith <roy at panix.com> writes:

> But, you are right, there are certainly cases which are difficult or
> impossible to test for. TDD is a very powerful tool, but it's just
> that: a tool. It's not a magic wand.
> 
> My suggestion is to make using TDD a habit, but don't turn it into a
> religion. You will undoubtedly find places where it's just the wrong
> tool.

All true.

I find it best to remember that the tests discussed in Behaviour
Driven Development are always *unit* tests: they test one small,
isolated unit of the application code, to ensure its behaviour is
correct given specific environment and inputs.

The cases where unit tests are not applicable include anything where
we want to assert behaviour of the entire application: performance
tests, acceptance tests, stress tests, etc.

Unit tests get a lot of discussion time simply because "test the
entire running application" isn't something many programmers will
disagree with, so they don't end up discussing it much. That doesn't
make unit tests *more* important; but it does mean more time is spent
convincing people that unit tests are *at least as* important as the
other tests.

> Don't let the fact that it can't do everything keep you from using
> it when it makes sense.

Yes.

-- 
 \        "Don't worry about people stealing your ideas. If your ideas |
  `\    are any good, you'll have to ram them down people's throats."  |
_o__)                                                  -- Howard Aiken |
Ben Finney



More information about the Python-list mailing list