1 Oct 2004 01:42
Re: Re: Where to put test code
Michael Feathers <mfeathers <at> mindspring.com>
2004-09-30 23:42:45 GMT
2004-09-30 23:42:45 GMT
Brian Button wrote: > Edwin Gabriel Castro wrote: > > If I'm *really* test driving the development of a class then my > first step > > is to write a test for a small piece of the functionality. That > > functionality has to be public by definition. I never add > implementation > > code unless my test is failing. I only refactor to remove > duplication... If > > I run a coverage tool I will see that any refactorings I made (which > could > > be protected, private, or internal) should be covered with the current > > tests. > > But, at least in the .Net world, there are 2 kinds of public. There are > the true public classes and methods, and there are those that are > internal. The internal stuff offers services to other classes in the > same assembly, and these services are complicated enough to need to be > tested themselves. > > We talked about this internally, and we chose to test internal methods. > And the only way to test them (without using fancy reflection), is to > put the tests and code in the same assembly. Since we're shipping a > library, we can't have extra classes cluttering the real public API. > I like putting them together too. When teams want to separate them, I always ask why. Sometimes there is a good reason, at other times, it is just because people feel uncomfortable having their testing code so close to their production code. If that(Continue reading)
Well, Brian's not going to toot his own horn on this one, but he's been
doing TDD longer than about 99% of the developers who've tried it. He's
trained people in it for years, he's one of the best developers I know
and he's worked with some of the best developers I've ever met.
Michael (that was just a compensatory toot.. something the conversation
needed)
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
RSS Feed