<?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: BDD Test Naming Experiment</title>
	<atom:link href="http://elegantcode.com/2008/09/08/bdd-test-naming-experiment/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2008/09/08/bdd-test-naming-experiment/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=bdd-test-naming-experiment</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 23:42:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
	<item>
		<title>By: mike</title>
		<link>http://elegantcode.com/2008/09/08/bdd-test-naming-experiment/comment-page-1/#comment-31874</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Mon, 08 Sep 2008 16:28:37 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/09/08/bdd-test-naming-experiment/#comment-31874</guid>
		<description>lately i&#039;ve been encoding the Given/When on the test class name and every test starts with Should (i&#039;m kinda leaning more to Given/When/Should). 

Given_AcmeEmployee_When_Create.Should_setup_Id
Given_AcmeEmployee_When_Create.Should_setup_Name
Given_AcmeEmployee_When_Create.Should_setup_LastName

Given_AcmeEmployeeRepository_When_Delete_Employee.Should_not_have_Employee
Given_AcmeEmployeeRepository_When_ClearAll_Employees.Should_not_have_any_Employee

also notice that VS support for test lists is awful. i&#039;d rather have a test list named &#039;Given_Context&#039;, then the test name &#039;When_Action&#039; and every test name &#039;Should_do something&#039;. in that setup i would use 3 columns in the test result window. However, like i said, VS support for test list is pathetic :)

cheers
mike</description>
		<content:encoded><![CDATA[<p>lately i&#8217;ve been encoding the Given/When on the test class name and every test starts with Should (i&#8217;m kinda leaning more to Given/When/Should). </p>
<p>Given_AcmeEmployee_When_Create.Should_setup_Id<br />
Given_AcmeEmployee_When_Create.Should_setup_Name<br />
Given_AcmeEmployee_When_Create.Should_setup_LastName</p>
<p>Given_AcmeEmployeeRepository_When_Delete_Employee.Should_not_have_Employee<br />
Given_AcmeEmployeeRepository_When_ClearAll_Employees.Should_not_have_any_Employee</p>
<p>also notice that VS support for test lists is awful. i&#8217;d rather have a test list named &#8216;Given_Context&#8217;, then the test name &#8216;When_Action&#8217; and every test name &#8216;Should_do something&#8217;. in that setup i would use 3 columns in the test result window. However, like i said, VS support for test list is pathetic <img src='http://elegantcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>cheers<br />
mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan Van Ryswyck</title>
		<link>http://elegantcode.com/2008/09/08/bdd-test-naming-experiment/comment-page-1/#comment-31831</link>
		<dc:creator>Jan Van Ryswyck</dc:creator>
		<pubDate>Mon, 08 Sep 2008 08:05:10 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/09/08/bdd-test-naming-experiment/#comment-31831</guid>
		<description>I agree with Jarod. I&#039;m also a fan of the When-Then approach. The framework from Scott Bellware he is referring to is called SpecUnit.NET and can be found on Google Code. (http://code.google.com/p/specunit-net/). You can take a look at the banking example for getting an idea of the naming style.</description>
		<content:encoded><![CDATA[<p>I agree with Jarod. I&#8217;m also a fan of the When-Then approach. The framework from Scott Bellware he is referring to is called SpecUnit.NET and can be found on Google Code. (<a href="http://code.google.com/p/specunit-net/" rel="nofollow">http://code.google.com/p/specunit-net/</a>). You can take a look at the banking example for getting an idea of the naming style.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jarod</title>
		<link>http://elegantcode.com/2008/09/08/bdd-test-naming-experiment/comment-page-1/#comment-31828</link>
		<dc:creator>Jarod</dc:creator>
		<pubDate>Mon, 08 Sep 2008 07:34:51 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/09/08/bdd-test-naming-experiment/#comment-31828</guid>
		<description>I think its a good start. The tests are still very &#039;code&#039; like in nature, focused on the objects themselves (Employee, Repo, EmailAddress). 

The idea with BDD - Specification Context is that we want to take it to the &#039;Behavior&#039; level. Following a good naming convention will force you to drive the behavior out. This is where is gets confusing as the ideas are fairly new. There are a lot of camps here as far as naming and structuring tests goes. The Given\When\Then, Because\It, When\Should. 

I prefer the When\Should approach. The &#039;When&#039; here represents the class name. The class will be responsible for setting up the &#039;Context&#039; of the behavior (Think SetUp). The &#039;Should&#039; represents the test methods of the class, the &#039;Specification&#039;.

So taking your first class here AcmeEmployee_Should, we could change that represent some sort of event that occurs. I am thinking:

When_An_Employee_Is_Created: (Context - create an employee)
-Should_Have_A_Unique_Identity (Assert Specification)
-Should_Have_A_First_Name (Assert Specification)
-Email_Address_Should_Be_Valid (Assert Specification)
Etc.

So we have taken test focus away from the AcmeEmployee, and applied it to the behavior of when an employee is created. (And of course moved the code into a factory)

Lets stab at one more, moving the focus away from the repository, to something that it &quot;does&quot;.

When_Adding_A_New_Employee
- Employee_Should_Not_Exist
- Audit_Should_Indicate_Added_Date
- Should_Record_Name_Of_User_Adding_Employee

When_Attempting_To_Add_An_Existing_Employee
- Should_Notify_User_Exists
etc, etc

Notice we do not talk about exceptions, id&#039;s, singletons, construction etc. Just plain ol english a user might understand. We end up with a lot more test classes, but they are much more meaningful and easier comprehend. For a given context we may have 5 specifications or so, plus or minus 3. Ideally, we want all the work to happen in the setup (CreateContext, Before_Each_Specification) with the specification being one line of english as the test name, and one line of code doing the assertion.

Most of this view comes from Scott Bellware&#039;s style of BDD.(caught his session at Alt.Net Seattle) I think he has an app/runner that he is working on, though I just use NUnit.</description>
		<content:encoded><![CDATA[<p>I think its a good start. The tests are still very &#8216;code&#8217; like in nature, focused on the objects themselves (Employee, Repo, EmailAddress). </p>
<p>The idea with BDD &#8211; Specification Context is that we want to take it to the &#8216;Behavior&#8217; level. Following a good naming convention will force you to drive the behavior out. This is where is gets confusing as the ideas are fairly new. There are a lot of camps here as far as naming and structuring tests goes. The Given\When\Then, Because\It, When\Should. </p>
<p>I prefer the When\Should approach. The &#8216;When&#8217; here represents the class name. The class will be responsible for setting up the &#8216;Context&#8217; of the behavior (Think SetUp). The &#8216;Should&#8217; represents the test methods of the class, the &#8216;Specification&#8217;.</p>
<p>So taking your first class here AcmeEmployee_Should, we could change that represent some sort of event that occurs. I am thinking:</p>
<p>When_An_Employee_Is_Created: (Context &#8211; create an employee)<br />
-Should_Have_A_Unique_Identity (Assert Specification)<br />
-Should_Have_A_First_Name (Assert Specification)<br />
-Email_Address_Should_Be_Valid (Assert Specification)<br />
Etc.</p>
<p>So we have taken test focus away from the AcmeEmployee, and applied it to the behavior of when an employee is created. (And of course moved the code into a factory)</p>
<p>Lets stab at one more, moving the focus away from the repository, to something that it &#8220;does&#8221;.</p>
<p>When_Adding_A_New_Employee<br />
- Employee_Should_Not_Exist<br />
- Audit_Should_Indicate_Added_Date<br />
- Should_Record_Name_Of_User_Adding_Employee</p>
<p>When_Attempting_To_Add_An_Existing_Employee<br />
- Should_Notify_User_Exists<br />
etc, etc</p>
<p>Notice we do not talk about exceptions, id&#8217;s, singletons, construction etc. Just plain ol english a user might understand. We end up with a lot more test classes, but they are much more meaningful and easier comprehend. For a given context we may have 5 specifications or so, plus or minus 3. Ideally, we want all the work to happen in the setup (CreateContext, Before_Each_Specification) with the specification being one line of english as the test name, and one line of code doing the assertion.</p>
<p>Most of this view comes from Scott Bellware&#8217;s style of BDD.(caught his session at Alt.Net Seattle) I think he has an app/runner that he is working on, though I just use NUnit.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan Van Ryswyck</title>
		<link>http://elegantcode.com/2008/09/08/bdd-test-naming-experiment/comment-page-1/#comment-31826</link>
		<dc:creator>Jan Van Ryswyck</dc:creator>
		<pubDate>Mon, 08 Sep 2008 07:22:17 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/09/08/bdd-test-naming-experiment/#comment-31826</guid>
		<description>I&#039;m more in a Given - when - then place: http://vanryswyckjan.blogspot.com/2008/02/exploring-bdd-style-specifications-as.html

http://specunit-net.googlecode.com/files/SpecUnit.Specs.html</description>
		<content:encoded><![CDATA[<p>I&#8217;m more in a Given &#8211; when &#8211; then place: <a href="http://vanryswyckjan.blogspot.com/2008/02/exploring-bdd-style-specifications-as.html" rel="nofollow">http://vanryswyckjan.blogspot.com/2008/02/exploring-bdd-style-specifications-as.html</a></p>
<p><a href="http://specunit-net.googlecode.com/files/SpecUnit.Specs.html" rel="nofollow">http://specunit-net.googlecode.com/files/SpecUnit.Specs.html</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

