I put together a class yesterday to do some useful task. I started alpha testing, and at some point realized I was adding alpha test related methods to the class itself. It hit me that they don't belong there. After a bit of head scratching I derived a test class from the base class that has access to the protected members as well. I put all of the testing related methods, and set up and tear down in the test class, and left the base class lean and mean as the old saying goes.
After browsing around here awhile I found one comment that suggested using this sort of technique by making the testing class a friend of the real class.
In retrospect both of those techniques should have been obvious to me.
What I am looking for, are techniques for specifically alpha testing/unit testing classes, without adding to the weight of the class being tested.
What techniques have you personally used, and recommend?