Thursday, January 27, 2005

Testing Interfaces

Another blog item on testing.

This one asks whether the tests themselves should alter the interface of what's being tested. i.e. should the test have a back door for peeking into the black box.

My opinion is, emphatically, no. Not for the kinds of tests created while test-first programming.

An impulse to check on the internal state of an object while test-first programming is an indication of one or two things:

  • The test is being perceived too much as "testing" and not enough as "designing".
  • The object itself is probably too complex. Fix the design.

No comments:

Post a Comment