On 13 Feb 2007, at 18:49, Eric Wilhelm wrote:
[snip]
How about, "a thing into which the item under test gets inserted"? The
c2 wiki (http://c2.com/cgi/wiki?TestFixture) has it as analogous to an
electronics test fixture. They should probably include "light fixture"
as a very simple metaphor.  If you're testing electric lamps
(non-engineers usually call them "light bulbs"), you screw them into a
test fixture, plug it in, and flip the switch.  This emulates the
production environment, but with known variables (input voltage,
surface reflectance, etc) so you can measure the luminosity and verify
that it is within spec.

So, the fixture gives you the surrounding environment (and/or related
inputs, overrides CORE::GLOBAL::time and whatever), then your test just involves one chunk of code and the direct inputs to it. e.g. You might have several fixtures, each of which creates an object with a known set
of attributes, then the tests call a method call on that object with
various parameters.
[snip]

That's it exactly. Especially that bit about multiple fixtures. Some people seem to get confused and try and test a class with one uber- fixture rather than build specialised ones.

Adrian

Reply via email to