On Thu, 30 Aug 2001 06:10:32 +0100, "Paul Sinnett"
>> If, in order to write a test case, I must make an otherwise private
>> variable public, then I will make it public and communicate my intent
>> in some other way.
>If you are exposing the internals for testing purposes then you are
>writing tests that are dependent on the implementation details.
Yes, though the kind of exposing one does is usually just to get
access to internal state, not to do anything _really_ hideous. But ...
>Doesn't this impede refactoring since you would have to change the tests
>if you changed only the implementation details?
To a degree it does. So when I am feeling the urge to rip open an
object to find out what it is doing, I take that as an indication
suggesting that I need a better way. Often, paying attention to that
indication produces a better idea. But if I don't get a better idea,
then I _do_ put in the access for the test. If we do have to refactor
the code (and tests), we'll probably see then what parts of the object
needed to be pulled out for separate testing. And if not ... I'd
rather have the tests and do a little extra work.
Ronald E Jeffries