<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Context/Spec style testing and my approach to BDD</title>
	<atom:link href="http://lostechies.com/ryansvihla/2009/05/22/context-spec-style-testing-and-my-approach-to-bdd/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/ryansvihla/2009/05/22/context-spec-style-testing-and-my-approach-to-bdd/</link>
	<description>The small minded meanderings of the confused</description>
	<lastBuildDate>Mon, 15 Apr 2013 15:10:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Ryan Svihla</title>
		<link>http://lostechies.com/ryansvihla/2009/05/22/context-spec-style-testing-and-my-approach-to-bdd/#comment-14</link>
		<dc:creator>Ryan Svihla</dc:creator>
		<pubDate>Thu, 28 May 2009 05:55:03 +0000</pubDate>
		<guid isPermaLink="false">/blogs/rssvihla/archive/2009/05/21/context-spec-style-testing-and-my-approach-to-bdd.aspx#comment-14</guid>
		<description>@Scott

Ok reading some of your older comments on other blogs, and thinking about it some more. Ultimately, I&#039;m making too many trivialities viewable in the code. 

My setup methods should be hidden by a useful named factory, and anyone should be able to scan my test instantly and not be distracted by the extra noise going on, further analysis would just involved inspecting the method.

Naming of that factory or object mother would be a key import trick and something I&#039;d have to practice to get right.

I&#039;ll take everyone&#039;s advice here to heart try some experiments in my day to day code and see what I come up with. once I&#039;m done I&#039;ll try and post a beginner focused BDD post.</description>
		<content:encoded><![CDATA[<p>@Scott</p>
<p>Ok reading some of your older comments on other blogs, and thinking about it some more. Ultimately, I&#8217;m making too many trivialities viewable in the code. </p>
<p>My setup methods should be hidden by a useful named factory, and anyone should be able to scan my test instantly and not be distracted by the extra noise going on, further analysis would just involved inspecting the method.</p>
<p>Naming of that factory or object mother would be a key import trick and something I&#8217;d have to practice to get right.</p>
<p>I&#8217;ll take everyone&#8217;s advice here to heart try some experiments in my day to day code and see what I come up with. once I&#8217;m done I&#8217;ll try and post a beginner focused BDD post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Svihla</title>
		<link>http://lostechies.com/ryansvihla/2009/05/22/context-spec-style-testing-and-my-approach-to-bdd/#comment-13</link>
		<dc:creator>Ryan Svihla</dc:creator>
		<pubDate>Fri, 22 May 2009 20:19:46 +0000</pubDate>
		<guid isPermaLink="false">/blogs/rssvihla/archive/2009/05/21/context-spec-style-testing-and-my-approach-to-bdd.aspx#comment-13</guid>
		<description>@Scott 

Thanks for the constructive criticism and I appreciate you dropping by.

My goal with this was to aim for something that could create a  decent output while still structuring my tests in a way that I could dive into a rule when I needed to maintain something later.  In that so far I&#039;m happy, but I&#039;m more than open to any improvements.

I&#039;m still an eager student with this stuff, would you care to enlighten me further on &quot;scannability&quot;? or can you point me to where I&#039;m off specifically? Maybe a resource i need to read first?
</description>
		<content:encoded><![CDATA[<p>@Scott </p>
<p>Thanks for the constructive criticism and I appreciate you dropping by.</p>
<p>My goal with this was to aim for something that could create a  decent output while still structuring my tests in a way that I could dive into a rule when I needed to maintain something later.  In that so far I&#8217;m happy, but I&#8217;m more than open to any improvements.</p>
<p>I&#8217;m still an eager student with this stuff, would you care to enlighten me further on &#8220;scannability&#8221;? or can you point me to where I&#8217;m off specifically? Maybe a resource i need to read first?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Bellware</title>
		<link>http://lostechies.com/ryansvihla/2009/05/22/context-spec-style-testing-and-my-approach-to-bdd/#comment-12</link>
		<dc:creator>Scott Bellware</dc:creator>
		<pubDate>Fri, 22 May 2009 19:38:41 +0000</pubDate>
		<guid isPermaLink="false">/blogs/rssvihla/archive/2009/05/21/context-spec-style-testing-and-my-approach-to-bdd.aspx#comment-12</guid>
		<description>Not exactly what I had in mind when I started using &quot;Context Specification&quot; to describe the method I use with *spec tools.

Solubility is not an option in context specification.  I don&#039;t find the descriptions above as soluble as they should be.  Sure I can read them - they&#039;re readable.  But the focus is first on scannability.  Don&#039;t force me to have to read what should be scanned.

Context specification is as much about code usability as it is adopting a new kind of testing framework.</description>
		<content:encoded><![CDATA[<p>Not exactly what I had in mind when I started using &#8220;Context Specification&#8221; to describe the method I use with *spec tools.</p>
<p>Solubility is not an option in context specification.  I don&#8217;t find the descriptions above as soluble as they should be.  Sure I can read them &#8211; they&#8217;re readable.  But the focus is first on scannability.  Don&#8217;t force me to have to read what should be scanned.</p>
<p>Context specification is as much about code usability as it is adopting a new kind of testing framework.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paco</title>
		<link>http://lostechies.com/ryansvihla/2009/05/22/context-spec-style-testing-and-my-approach-to-bdd/#comment-11</link>
		<dc:creator>Paco</dc:creator>
		<pubDate>Fri, 22 May 2009 18:34:59 +0000</pubDate>
		<guid isPermaLink="false">/blogs/rssvihla/archive/2009/05/21/context-spec-style-testing-and-my-approach-to-bdd.aspx#comment-11</guid>
		<description>I use inheritance for that. 
public class When_creating_a_user : with_new_user_service
{
 override Context() 
 {
    DoSomeSpecificMocking();
 }

 Because()
 {
    user = service.CreateUser();
 }

}

public class with_new_user_service : ContextSpec
{
   override Context()
   {
     DoCommonStubbingAndServiceInstantiation();
   }
}
</description>
		<content:encoded><![CDATA[<p>I use inheritance for that.<br />
public class When_creating_a_user : with_new_user_service<br />
{<br />
 override Context()<br />
 {<br />
    DoSomeSpecificMocking();<br />
 }</p>
<p> Because()<br />
 {<br />
    user = service.CreateUser();<br />
 }</p>
<p>}</p>
<p>public class with_new_user_service : ContextSpec<br />
{<br />
   override Context()<br />
   {<br />
     DoCommonStubbingAndServiceInstantiation();<br />
   }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Svihla</title>
		<link>http://lostechies.com/ryansvihla/2009/05/22/context-spec-style-testing-and-my-approach-to-bdd/#comment-10</link>
		<dc:creator>Ryan Svihla</dc:creator>
		<pubDate>Fri, 22 May 2009 18:11:59 +0000</pubDate>
		<guid isPermaLink="false">/blogs/rssvihla/archive/2009/05/21/context-spec-style-testing-and-my-approach-to-bdd.aspx#comment-10</guid>
		<description>@paco I&#039;d be happier still with.


public void SetUp()

{
//common stubbing and service instantiation
 Context();

 Because();

}

  public virtual void Context() {}

  public virtual void Because() {}

}

and then i&#039;m totally in agreement, nice touch.</description>
		<content:encoded><![CDATA[<p>@paco I&#8217;d be happier still with.</p>
<p>public void SetUp()</p>
<p>{<br />
//common stubbing and service instantiation<br />
 Context();</p>
<p> Because();</p>
<p>}</p>
<p>  public virtual void Context() {}</p>
<p>  public virtual void Because() {}</p>
<p>}</p>
<p>and then i&#8217;m totally in agreement, nice touch.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paco</title>
		<link>http://lostechies.com/ryansvihla/2009/05/22/context-spec-style-testing-and-my-approach-to-bdd/#comment-9</link>
		<dc:creator>Paco</dc:creator>
		<pubDate>Fri, 22 May 2009 17:52:44 +0000</pubDate>
		<guid isPermaLink="false">/blogs/rssvihla/archive/2009/05/21/context-spec-style-testing-and-my-approach-to-bdd.aspx#comment-9</guid>
		<description>I don&#039;t mean renaming the setup method, but I mean placing the executing of the method under test seperated from the context where it&#039;s executed in.

public class ContextSpec
{
public void SetUp()
{
  Context();
  Because();
}

   public virtual void Context() {}
   public virtual void Because() {}
}

I have done this for a while, but I&#039;m using MSpec now.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t mean renaming the setup method, but I mean placing the executing of the method under test seperated from the context where it&#8217;s executed in.</p>
<p>public class ContextSpec<br />
{<br />
public void SetUp()<br />
{<br />
  Context();<br />
  Because();<br />
}</p>
<p>   public virtual void Context() {}<br />
   public virtual void Because() {}<br />
}</p>
<p>I have done this for a while, but I&#8217;m using MSpec now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Svihla</title>
		<link>http://lostechies.com/ryansvihla/2009/05/22/context-spec-style-testing-and-my-approach-to-bdd/#comment-8</link>
		<dc:creator>Ryan Svihla</dc:creator>
		<pubDate>Fri, 22 May 2009 12:51:04 +0000</pubDate>
		<guid isPermaLink="false">/blogs/rssvihla/archive/2009/05/21/context-spec-style-testing-and-my-approach-to-bdd.aspx#comment-8</guid>
		<description>@jlivesay depends on how I&#039;m interpreting  your example there:

I considered and played with using a template for the base setup method when i started doing this.  I ended up having the same  calls a lot. for example when setting up context that has to be there for most scenarios like return values that are passed on to another method, or the MockRepository.GenerateMock&lt;T&gt; calls over and over again.

Now if you&#039;re suggesting have a base abstract to help remind people to AddContextSpecific behavior I think you&#039;re correct that would help matters out for my team and other future maintainers.  I&#039;d still need a base.SetUp() to setup all the normal boring stuff that doesn&#039;t change from test to test.
</description>
		<content:encoded><![CDATA[<p>@jlivesay depends on how I&#8217;m interpreting  your example there:</p>
<p>I considered and played with using a template for the base setup method when i started doing this.  I ended up having the same  calls a lot. for example when setting up context that has to be there for most scenarios like return values that are passed on to another method, or the MockRepository.GenerateMock<t> calls over and over again.</p>
<p>Now if you&#8217;re suggesting have a base abstract to help remind people to AddContextSpecific behavior I think you&#8217;re correct that would help matters out for my team and other future maintainers.  I&#8217;d still need a base.SetUp() to setup all the normal boring stuff that doesn&#8217;t change from test to test.<br />
</t></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jlivesay</title>
		<link>http://lostechies.com/ryansvihla/2009/05/22/context-spec-style-testing-and-my-approach-to-bdd/#comment-7</link>
		<dc:creator>jlivesay</dc:creator>
		<pubDate>Fri, 22 May 2009 12:38:46 +0000</pubDate>
		<guid isPermaLink="false">/blogs/rssvihla/archive/2009/05/21/context-spec-style-testing-and-my-approach-to-bdd.aspx#comment-7</guid>
		<description>Might you want to template the base context Setup method for clarity?

        [SetUp]
        public  void SetUp()
        {
           // init common fields ...
            _sender = ...
           
           AddContextSpecificBehavior();                       
        }

        public abstract void AddContextSpecificBehavior();

Then each new context would need to implement the AddContextSpecificBehavior method but not be tied to the base.Setup() call, which can be an easy thing to forget to do. The compiler forcing the implementation of the abstract method also is more explicit about how the pattern works. </description>
		<content:encoded><![CDATA[<p>Might you want to template the base context Setup method for clarity?</p>
<p>        [SetUp]<br />
        public  void SetUp()<br />
        {<br />
           // init common fields &#8230;<br />
            _sender = &#8230;</p>
<p>           AddContextSpecificBehavior();<br />
        }</p>
<p>        public abstract void AddContextSpecificBehavior();</p>
<p>Then each new context would need to implement the AddContextSpecificBehavior method but not be tied to the base.Setup() call, which can be an easy thing to forget to do. The compiler forcing the implementation of the abstract method also is more explicit about how the pattern works. </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Svihla</title>
		<link>http://lostechies.com/ryansvihla/2009/05/22/context-spec-style-testing-and-my-approach-to-bdd/#comment-6</link>
		<dc:creator>Ryan Svihla</dc:creator>
		<pubDate>Fri, 22 May 2009 11:28:01 +0000</pubDate>
		<guid isPermaLink="false">/blogs/rssvihla/archive/2009/05/21/context-spec-style-testing-and-my-approach-to-bdd.aspx#comment-6</guid>
		<description>@Wookie

Updated code to reflect what I was talking about.  If you still have comments or suggestions let me know.

thanks again.</description>
		<content:encoded><![CDATA[<p>@Wookie</p>
<p>Updated code to reflect what I was talking about.  If you still have comments or suggestions let me know.</p>
<p>thanks again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Svihla</title>
		<link>http://lostechies.com/ryansvihla/2009/05/22/context-spec-style-testing-and-my-approach-to-bdd/#comment-5</link>
		<dc:creator>Ryan Svihla</dc:creator>
		<pubDate>Fri, 22 May 2009 11:11:17 +0000</pubDate>
		<guid isPermaLink="false">/blogs/rssvihla/archive/2009/05/21/context-spec-style-testing-and-my-approach-to-bdd.aspx#comment-5</guid>
		<description>@Wookie

Yes I normally do the When for the context,  but usually only after the first scenario is baked then the naming is easier. I&#039;ll update it later with the new scenario&#039;s and maybe it&#039;ll be closer to your thinking. 

@Paco

Could you give me an example? do you mean like naming the SetUp methods BecauseUserWasAlreadyInTheSystem ?

Good feedback guys I appreciate it.</description>
		<content:encoded><![CDATA[<p>@Wookie</p>
<p>Yes I normally do the When for the context,  but usually only after the first scenario is baked then the naming is easier. I&#8217;ll update it later with the new scenario&#8217;s and maybe it&#8217;ll be closer to your thinking. </p>
<p>@Paco</p>
<p>Could you give me an example? do you mean like naming the SetUp methods BecauseUserWasAlreadyInTheSystem ?</p>
<p>Good feedback guys I appreciate it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
