Re: Three Law of TDD - to strictly follow, or not?
"Adam Sroka [email protected] [testdrivendevelopment]" <[email protected]> Thu, 28 Aug 2014 11:38:23 -0700
| Newsgroups | gmane.comp.programming.test-driven-development |
|---|---|
| Message-ID | <CALaPUVd60Qzcj4yDrUy9ek+ykobaojWOYP0CC0SQyy5MTZ2x1Q@mail.gmail.com> |
Starting with acceptance tests is a great idea. So is starting with high level unit tests, mocking the details, and then working your way down. Also, sometimes if I think I know what the essence of the problem is I will start there, or if I'm not even sure how I am going to do it I may just pick something to spike. Any of these techniques, or a combination, can be used with a given story. TMTOWTDI On Thursday, August 28, 2014, George Dinwiddie [email protected] [testdrivendevelopment] <[email protected]> wrote: > > > Michal, > > On 8/28/14 12:03 PM, Michal Svoboda [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');> > [testdrivendevelopment] wrote: > > Kaleb Pederson [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');> > [testdrivendevelopment] wrote: > >> When the entire test is written up front (for a new class at least) > >> the test will fail, because a failure to compile is considered a > >> failure. The problem that I have with the approach is that when it > >> "passes", does it pass for the right reason? Or, do we have > >> unnecessary test code? or production code? Did the test ever fail for > >> the expected reason, or did it fail only in the form of a compilation > >> failure? > > > > Hi Kaleb, > > > > I hear what you are saying. But it really goes down to that gut feeling. > > Sometimes I want to see the whole story first, not just "once upon a > > time there was an object". It usually depends on what level of certainty > > I feel over my requirements. The objective is to drive the design with > > the test, not to just write it first. > > I write acceptance tests all at once. I write unit tests a bit at a > time, often starting with the creation of a new object whose definition > does not yet exist. In this fashion I work inside-out within the bounds > of outside-in. > > > Even if the test is written in a bigger chunk, you can still add in the > > code one bit at a time and see the test fail for various reasons until > > you get (and subsequently fix) the desired one. > > With effort, you can. But how does that drive the design? > > - George > > -- > ---------------------------------------------------------- > * George Dinwiddie * http://blog.gdinwiddie.com > Software Development http://www.idiacomputing.com > Consultant and Coach http://www.agilemaryland.org > ---------------------------------------------------------- > > >