Schrade.Blog : Behavior Driven Development: Inside-Out vs Outside-In Pattern http://kurt.karmalab.org/articles/2007/05/04/behavior-driven-development-inside-out-vs-outside-in-patterns.rss en-us 40 Tech and Business Ramblings by Kurt Schrader Comment on Behavior Driven Development: Inside-Out vs Outside-In Pattern by Kerry Buckley <p>I definitely prefer outside-in. A couple of justifications:</p> <ol> <li><p>The context should represent a state, not an object or method. "A sword" is only a context if you're specifying behaviour for all swords, "A new sword" describes a sword in a certain state, and "sharp?" seems to me to be a programmer-centric way of writing specs (more like an early xUnit approach, where we used to generally write one test per method).</p></li> <li><p>I also like to keep to one assertion per test, so the inside-out example would have to be split into "should return true when the sword is new" and "should return false when the sword is used". This is slightly more expressive than your example, but still seems to describe what the code does, rather than how the object behaves. This might not always be a bad thing, but I don't think it's really BDD.</p></li> </ol> Fri, 04 May 2007 03:21:35 -0700 urn:uuid:aa09379c-46d3-4ed4-bec8-4fa2a70048a7 http://kurt.karmalab.org/articles/2007/05/04/behavior-driven-development-inside-out-vs-outside-in-patterns#comment-887 Comment on Behavior Driven Development: Inside-Out vs Outside-In Pattern by Aslak Hellesøy <p>Outside in man. Inside out sounds like after-the-fact testing, missing the point of TDD/BDD.</p> <p>You can say:</p> <p>sword.should be_sharp</p> Fri, 04 May 2007 04:20:53 -0700 urn:uuid:74e3f6ff-9b52-4b7a-b36e-36357b05e116 http://kurt.karmalab.org/articles/2007/05/04/behavior-driven-development-inside-out-vs-outside-in-patterns#comment-888 Trackback from Inforbiomatica: BDD: specifying domain objects de novo on Behavior Driven Development: Inside-Out vs Outside-In Pattern <p>The vanilla example used in most blog posts for BDD is some incarnation of de novo domain object specification, that is, specifying the behavior of a simple domain object from scratch. David Chelimsky&#8217;s stack example is a decent online examp...</p> Sun, 06 May 2007 17:50:56 -0700 urn:uuid:09ff1773-aa03-461e-8a03-2135789a61b2 http://kurt.karmalab.org/articles/2007/05/04/behavior-driven-development-inside-out-vs-outside-in-patterns#trackback-897 Comment on Behavior Driven Development: Inside-Out vs Outside-In Pattern by Moses Hohman <p>One of Kurt's mysterious coworkers here. Another problem with the inside-out approach above is the name of the example, "sharp?", which is pretty meaningless when you see it in the HTML output of a bunch of specs. Funny for me to say that, because I was the guy discussing this with Kurt. I'm not sure if I'm in a camp, but if I am, I wouldn't describe the camps in this way.</p> <p>I tried to <a href="http://www.moseshohman.com/blog/2007/05/06/43" rel="nofollow">write something</a> about the original example that prompted this discussion, but midpost realized that the method in question (<code>blank?</code>) was only used in one place, in the spec code for a collaborating class, so I thought that was a bad example. So instead I focused on a similar situation in the specification of the behavior of the same class. Hopefully more detail helps clarify things.</p> Sun, 06 May 2007 18:09:51 -0700 urn:uuid:103d14e9-5883-4a8f-8167-d1c72ba86312 http://kurt.karmalab.org/articles/2007/05/04/behavior-driven-development-inside-out-vs-outside-in-patterns#comment-898