Thursday, November 24, 2005 12:15 PM
pdbartlett
Testlets, unit tests and INSULTs
This is NOT about Microsoft's alleged attempt at redefining TDD, so if that's been done to death as far as you're concerned (and I'm purposely not taking a stance on this) then you can read on in safety...
There seem to be two common definitions of unit tests: the "purist" one where only the object under test may be used, so all interactions with other objects must use "mocks"; and a more pragmatic one where some integration testing effectively takes place, e.g. access to a database, but the other properties of unit tests (small, automated, can be run independently from other tests) are preserved. These mini-integration tests therefore have more commonalities with unit tests than they have differences from them.
Both these types of testing are perfectly valid, and I've used both. The problem comes when you get people from the two different "camps" talking about testing strategy. At best you get some confusion over terminolgy, and at worst a "religious war" which distracts from the issues at hand.
I'd therefore like to suggest the following:

Testlets are therefore anything that can (sensibly) be written and run using frameworks like jUnit, and are usually what people mean when they casually talk about unit tests.
Unit tests correspond to the "purist" definition, because almost by definition the pragmatists are more likely to be amenable to changing terminology if it helps progress on "real" work.
Independentally-runnable Non-isolated Small Unit-Like Tests, or INSULTs (temporary name - need one that doesn't have such derogatory connations, lest anyone think I'm a closet purist ;) are everything else.
As ever I'd be most interested to hear what other people think about this, including alternative names for INSULTs of course...