<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>rob bowley &#187; bdd</title>
	<atom:link href="http://blog.robbowley.net/tag/bdd/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.robbowley.net</link>
	<description>adventures in extreme programming</description>
	<lastBuildDate>Thu, 15 Jul 2010 08:12:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Thoughts on testing .Net code with RSpec, Cucumber &amp; IronRuby</title>
		<link>http://blog.robbowley.net/2009/02/22/thoughts-on-testing-net-code-with-rspec-ironruby/</link>
		<comments>http://blog.robbowley.net/2009/02/22/thoughts-on-testing-net-code-with-rspec-ironruby/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 17:20:27 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[ironruby]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://blog.robbowley.net/?p=256</guid>
		<description><![CDATA[In a previous article I said I&#8217;d like to test my .Net code using RSpec so I&#8217;ve spent some time this weekend having a go at just that. IronRuby is still at alpha so was pretty flaky and I spent a lot of time hacking IronRuby and RSpec, but satisfyingly I eventually got it all [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://blog.robbowley.net/2009/02/04/bdd-syntax/">previous article</a> I said I&#8217;d like to test my .Net code using <a href="http://rspec.info/">RSpec</a> so I&#8217;ve spent some time this weekend having a go at just that. <a href="http://www.ironruby.net/">IronRuby</a> is still at alpha so was pretty flaky and I spent a lot of time hacking IronRuby and RSpec, but satisfyingly I eventually got it all working and did a few proof of concept examples. Surprisingly or not, there&#8217;s quite a few people out there with the same idea so if you want to have a go you wouldn&#8217;t go too far wrong to look at some of the examples I found (although none of them worked for me straight out of the box):</p>
<p><a href="http://msdn.microsoft.com/en-us/magazine/dd434651.aspx">Getting Started With IronRuby And RSpec</a><br />
<a href="http://www.patrickgannon.net/archive/2008/10/23/bdd-style-feature-tests-using-ironruby-and-rspeccucumber.aspx">BDD-style feature tests using IronRuby and RSpec/Cucumber</a><br />
<a href="http://khebbie.dk/post/2008/08/27/Example-of-using-ironRubys-mini_rspec-library.aspx">Example of using ironRubys mini_rspec library</a></p>
<p>Yeah, so game on I think. If you&#8217;re not sure why I&#8217;m so excited by the prospect of doing this I suggest you have a look at some <a href="http://www.code-magazine.com/article.aspx?quickid=0805061&#038;page=1">BDD</a> examples using <a href="http://rspec.info/">RSpec</a> and <a href="http://cukes.info/">Cucumber</a>. In my mind it&#8217;s light years ahead of what we can currently do with the .Net framework. </p>
<p>Whilst I really like the idea of actually doing this I do have some reservations:</p>
<ul>
<li>You still have to compile your .Net code so no enormous time savings.
</li>
<li>RSpec takes some time to get going as well, which is not a problem if you&#8217;re doing a large run but might be quite annoying otherwise.
</li>
<li>Have no idea how you&#8217;d be able to get test coverage reports (I&#8217;m sure some bright spark will get this working soon enough).</li>
<li>Not exactly sure how debugging would work (stepping into your .Net code from an RSpec test).
</ul>
<p>On a side note and forgetting about the instability of it for a second I was really impressed with IronRuby and the CLR interop so, er.. *gulp* well done Microsoft!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.robbowley.net/2009/02/22/thoughts-on-testing-net-code-with-rspec-ironruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Behaviour Driven Development syntax</title>
		<link>http://blog.robbowley.net/2009/02/04/bdd-syntax/</link>
		<comments>http://blog.robbowley.net/2009/02/04/bdd-syntax/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 21:51:06 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://blog.robbowley.net/?p=185</guid>
		<description><![CDATA[I&#8217;ve been coding in the Behaviour Driven Development (BDD) style for a while now and thought I&#8217;d share my syntax at the state it has currently evolved to. Briefly, the idea behind of BDD is to have clear definition of business intent within your code, particularly your unit tests. The benefits are it&#8217;s easier to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been coding in the <a href="http://dannorth.net/introducing-bdd">Behaviour Driven Development</a> (BDD) style for a while now and thought I&#8217;d share my syntax at the state it has currently evolved to. Briefly, the idea behind of BDD is to have clear definition of business intent within your code, particularly your unit tests. The benefits are it&#8217;s easier to see what your system is supposed to be doing and your tests are more closely associated to the required behaviour of the system rather than the implementation, ergo, behaviour driven.</p>
<p>I originally started by making an effort to write my tests method names as sentences starting with &#8220;should&#8221; (e.g. should_set_active_status_to_false_when_status_updated), but having used the &#8220;Given, When, Then&#8221; format for our automated acceptance tests I&#8217;ve been trying to move more in this direction.</p>
<p>For a start, I&#8217;ve being using the Visual Studio solution explorer to help. Previously tests would be organised something like this:</p>
<p><img class="size-full wp-image-192" title="nonbdd_explorer" src="http://blog.robbowley.net/wp-content/uploads/2009/02/nonbdd_explorer.gif" alt="tests organised in explorer non bdd style" width="193" height="97" /></p>
<p>Which I have replaced with this:</p>
<p><img class="size-full wp-image-190" title="bdd_explorer" src="http://blog.robbowley.net/wp-content/uploads/2009/02/bdd_explorer.gif" alt="using solution explorer to help describe tests" width="332" height="99" /></p>
<p>As you can see I&#8217;m using folders and file names to help give the tests context. One major advantage of this is as the tests are less coupled to the implementation of the system under test (SUT) any changes to the implementation are less likely to require moving tests around so the intent remains intact. The other obvious advantage is the intended behaviour is much clearer.</p>
<p>The next thing to show you is the tests:</p>
<p><img class="alignnone size-full wp-image-206" title="bdd tests example 1" src="http://blog.robbowley.net/wp-content/uploads/2009/02/tests12.gif" alt="" width="575" height="266" /></p>
<p>The nice thing here is the namespace is taken from the folder and the class name from the file name so I&#8217;m getting a nice convention (even if it is being obfuscated by C# scaffolding). In this example I&#8217;m still sticking to the &#8220;should&#8221; convention but below I went for something a bit different:</p>
<p><img class="alignnone size-full wp-image-209" title="bdd tests example 2" src="http://blog.robbowley.net/wp-content/uploads/2009/02/tests22.gif" alt="" width="575" height="176" /></p>
<p>So this is a little different because the conditions are more specific. There&#8217;s another class for non view direct users so I split them up, partly so the test method names needn&#8217;t be so long but mainly because it&#8217;s easier to understand what&#8217;s going on. Purists may feel uncomfortable with my relative lack of a standardised syntax, but the most important thing to me is it&#8217;s easy to see what&#8217;s going on and beyond that I don&#8217;t particularly care how you say it.</p>
<p>What this really is is a feeble attempt to mimic the elegance you get from <a href="http://rspec.info/">RSpec</a> (which we&#8217;ve been using along with <a href="http://cukes.info/">Cucumber</a> &amp; <a href="http://wtr.rubyforge.org/">Watir</a> to write our automated tests). I was thinking today whilst I was playing with this that I don&#8217;t just want to mimic RSpec I actually want <em>write </em>my unit tests using RSpec. Excitingly it looks like the <a href="http://www.codeplex.com/dlr">DLR </a>and <a href="http://www.ironruby.net/">IronRuby</a> will <a href="http://msdn.microsoft.com/en-us/magazine/dd434651.aspx">make this possible</a>. Up until now I&#8217;d been struggling to think of a really appropriate use of a dynamic language within the .Net context but not any more.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.robbowley.net/2009/02/04/bdd-syntax/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
