Comment on Testing on High: Bottom-up versus Top-down Test-driven Development by Ryan Kinderman

Mon, 19 Nov 2007 18:22:15 -0800

@Yi: I wouldn't say it's impossible. I think I mention in the article that it's possible to code a solution directly using top-down development. I started doing something similar for an XML diffing algorithm I wrote not too long ago. I started with the most basic test that would demonstrate some diffing functionality, such as:

it "reports no difference between two empty strings"

This didn't get me too far, but it set things up like the top-level diffing method, its initial signature, and so forth. It wasn't until I had 20-something passing examples that I started recognizing a pattern and actually started pulling out classes. And even then, I didn't have to mock.

I ultimately did end up mocking to simplify the tests, but one can get away with not mocking using top-down development as well as they can with bottom-up. It's just a matter of how isolated the tests are going to be. Obviously, in either case, fully-isolated tests are the best scenario.