<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Mocks are hip when it comes to BDD</title>
	<link>http://thediscoblog.com/2007/07/03/mocks-are-hip-when-it-comes-to-bdd/</link>
	<description>Can you dig it man?</description>
	<pubDate>Wed, 09 Jul 2008 04:50:57 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: The Disco Blog &#187; Blog Archive &#187; Is BDD TDD done right?</title>
		<link>http://thediscoblog.com/2007/07/03/mocks-are-hip-when-it-comes-to-bdd/#comment-23141</link>
		<dc:creator>The Disco Blog &#187; Blog Archive &#187; Is BDD TDD done right?</dc:creator>
		<pubDate>Sun, 02 Sep 2007 00:41:00 +0000</pubDate>
		<guid>http://thediscoblog.com/2007/07/03/mocks-are-hip-when-it-comes-to-bdd/#comment-23141</guid>
		<description>[...] Because it&#8217;s my bag, I happen to agree with this notion (that BDD is TDD done right) but I find that BDD makes it a whole lot easier because it drops the word &#8220;test&#8221; in favor of &#8220;should&#8221;. And, as I&#8217;ve found, should rolls off the tongue quite naturally, man. Take the simple example of a queue data structure. Imagine someone has asked you to describe one&#8211; maybe you&#8217;d say something like this (note that I even left out the hip filler words in your favor, baby):  A queue is a first in first out data structure. It accepts items via an enqueue method and when dequeue is called, the oldest item (the item who was enqueued before everything else) in the queue should be returned. If dequeue is called on an empty queue, an exception should be thrown; plus, enqueue shouldn&#8217;t accept null as a value. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Because it&#8217;s my bag, I happen to agree with this notion (that BDD is TDD done right) but I find that BDD makes it a whole lot easier because it drops the word &#8220;test&#8221; in favor of &#8220;should&#8221;. And, as I&#8217;ve found, should rolls off the tongue quite naturally, man. Take the simple example of a queue data structure. Imagine someone has asked you to describe one&#8211; maybe you&#8217;d say something like this (note that I even left out the hip filler words in your favor, baby):  A queue is a first in first out data structure. It accepts items via an enqueue method and when dequeue is called, the oldest item (the item who was enqueued before everything else) in the queue should be returned. If dequeue is called on an empty queue, an exception should be thrown; plus, enqueue shouldn&#8217;t accept null as a value. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Test Early &#187; Using BDD to drive development</title>
		<link>http://thediscoblog.com/2007/07/03/mocks-are-hip-when-it-comes-to-bdd/#comment-19476</link>
		<dc:creator>Test Early &#187; Using BDD to drive development</dc:creator>
		<pubDate>Tue, 17 Jul 2007 01:58:03 +0000</pubDate>
		<guid>http://thediscoblog.com/2007/07/03/mocks-are-hip-when-it-comes-to-bdd/#comment-19476</guid>
		<description>[...] As I haven&#8217;t actually coded a the business class yet, I&#8217;ll use JBehave&#8217;s mocking library to roughly specify my intended behavior. For example, given what I believe is a good zip code, the validation service should return true and consequently, given a bad zip code, the service should reject it. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] As I haven&#8217;t actually coded a the business class yet, I&#8217;ll use JBehave&#8217;s mocking library to roughly specify my intended behavior. For example, given what I believe is a good zip code, the validation service should return true and consequently, given a bad zip code, the service should reject it. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will Sargent</title>
		<link>http://thediscoblog.com/2007/07/03/mocks-are-hip-when-it-comes-to-bdd/#comment-19154</link>
		<dc:creator>Will Sargent</dc:creator>
		<pubDate>Sat, 14 Jul 2007 02:27:53 +0000</pubDate>
		<guid>http://thediscoblog.com/2007/07/03/mocks-are-hip-when-it-comes-to-bdd/#comment-19154</guid>
		<description>Andy:

With regards to the DAO layer, I think that's a special case.  DAOs (and anything touching the database) are allowed to spit out pretty much anything, at any time, without reference to the underlying logic.  The most you can do is specify what data you think it will return, and work with it from there.

How to accurately test a DAO layer has been an issue for me as well.  I use Hibernate, so I've found it relatively easy to create a small in-memory database and use Hibernate schema creation to create tables, which I can then value with DBUnit.  However, I've run into issues with constraints and indexes where the Hibernate schema description doesn't quite match.  I've heard that some people use Unitils for this, but I can't comment on its effectiveness.</description>
		<content:encoded><![CDATA[<p>Andy:</p>
<p>With regards to the DAO layer, I think that&#8217;s a special case.  DAOs (and anything touching the database) are allowed to spit out pretty much anything, at any time, without reference to the underlying logic.  The most you can do is specify what data you think it will return, and work with it from there.</p>
<p>How to accurately test a DAO layer has been an issue for me as well.  I use Hibernate, so I&#8217;ve found it relatively easy to create a small in-memory database and use Hibernate schema creation to create tables, which I can then value with DBUnit.  However, I&#8217;ve run into issues with constraints and indexes where the Hibernate schema description doesn&#8217;t quite match.  I&#8217;ve heard that some people use Unitils for this, but I can&#8217;t comment on its effectiveness.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://thediscoblog.com/2007/07/03/mocks-are-hip-when-it-comes-to-bdd/#comment-18214</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Wed, 04 Jul 2007 18:06:34 +0000</pubDate>
		<guid>http://thediscoblog.com/2007/07/03/mocks-are-hip-when-it-comes-to-bdd/#comment-18214</guid>
		<description>Will- I figured someone would challenge that statement. Far too often when I see mocks being used, they are attempting to break a dependency within code for easier testing, but they dependency they are mocking is the heart of the test. For example, I once ran across a code base where the DAO layer was mocked out for a series of tests. On the surface, not bad and a good use of mocks; however, when I took a look at the DAO layer, it was completely custom with dynamic SQL queries based upon parameters, etc. There weren't any tests for this layer (except &lt;i&gt;indirect&lt;/i&gt; functional ones in later life cycles). So I found myself wondering why a mock layer was produced that ignored the heart of the code base that happened to be where issues usually popped up.</description>
		<content:encoded><![CDATA[<p>Will- I figured someone would challenge that statement. Far too often when I see mocks being used, they are attempting to break a dependency within code for easier testing, but they dependency they are mocking is the heart of the test. For example, I once ran across a code base where the DAO layer was mocked out for a series of tests. On the surface, not bad and a good use of mocks; however, when I took a look at the DAO layer, it was completely custom with dynamic SQL queries based upon parameters, etc. There weren&#8217;t any tests for this layer (except <i>indirect</i> functional ones in later life cycles). So I found myself wondering why a mock layer was produced that ignored the heart of the code base that happened to be where issues usually popped up.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://thediscoblog.com/2007/07/03/mocks-are-hip-when-it-comes-to-bdd/#comment-18213</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Wed, 04 Jul 2007 17:56:44 +0000</pubDate>
		<guid>http://thediscoblog.com/2007/07/03/mocks-are-hip-when-it-comes-to-bdd/#comment-18213</guid>
		<description>Stephan-- using &lt;a href="http://code.google.com/p/hamcrest/" rel="nofollow"&gt;Hamcrest&lt;/a&gt; with &lt;a href="http://testng.org/" rel="nofollow"&gt;TestNG&lt;/a&gt; for a more BDD style level of verification is an excellent (a.k.a hip) idea. Too bad that you still have to annotate a method with @Test though-- perhaps a @Behavior annotation would be interesting as an extension to TestNG (BehaviorNG? :)). Good call on the Fit/BDD non-developers applicability as well-- I do think Fit is a bit more helpful in bridging that gap.  

I don't have a really good reason for the use of a &lt;code&gt;Comparator&lt;/code&gt; other than I wanted to be able to compare any property within an &lt;code&gt;IMoon&lt;/code&gt; (assuming there would be more than just shown) and I wasn't sure of the actual property type-- I'm  using &lt;code&gt;double&lt;/code&gt; now but I'm wondering if it would be interesting to find a more applicable unit object for Km and earth days, etc.</description>
		<content:encoded><![CDATA[<p>Stephan&#8211; using <a href="http://code.google.com/p/hamcrest/" rel="nofollow">Hamcrest</a> with <a href="http://testng.org/" rel="nofollow">TestNG</a> for a more BDD style level of verification is an excellent (a.k.a hip) idea. Too bad that you still have to annotate a method with @Test though&#8211; perhaps a @Behavior annotation would be interesting as an extension to TestNG (BehaviorNG? :)). Good call on the Fit/BDD non-developers applicability as well&#8211; I do think Fit is a bit more helpful in bridging that gap.  </p>
<p>I don&#8217;t have a really good reason for the use of a <code>Comparator</code> other than I wanted to be able to compare any property within an <code>IMoon</code> (assuming there would be more than just shown) and I wasn&#8217;t sure of the actual property type&#8211; I&#8217;m  using <code>double</code> now but I&#8217;m wondering if it would be interesting to find a more applicable unit object for Km and earth days, etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephan Schmidt</title>
		<link>http://thediscoblog.com/2007/07/03/mocks-are-hip-when-it-comes-to-bdd/#comment-18187</link>
		<dc:creator>Stephan Schmidt</dc:creator>
		<pubDate>Wed, 04 Jul 2007 08:04:42 +0000</pubDate>
		<guid>http://thediscoblog.com/2007/07/03/mocks-are-hip-when-it-comes-to-bdd/#comment-18187</guid>
		<description>Good post, I've been doing BDD lately with TestNG, calling my methods should* and having a small adapter to Hamcrest which makes the asserts more BDD like. 

BDD feels more natural than testing for specifying behavior, though I think the level is mostly too low for non-developers, compared to FIT.

Something minor really: why not use o1.getOrbitPeriod().compareTo(...) or Double.compare(...)? :-)
-- 
Stephan Schmidt :: stephan@reposita.org
Reposita Open Source - Monitor your software development
http://www.reposita.org 
Blog at http://stephan.reposita.org - No signal. No noise.</description>
		<content:encoded><![CDATA[<p>Good post, I&#8217;ve been doing BDD lately with TestNG, calling my methods should* and having a small adapter to Hamcrest which makes the asserts more BDD like. </p>
<p>BDD feels more natural than testing for specifying behavior, though I think the level is mostly too low for non-developers, compared to FIT.</p>
<p>Something minor really: why not use o1.getOrbitPeriod().compareTo(&#8230;) or Double.compare(&#8230;)? <img src='http://thediscoblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
&#8211;<br />
Stephan Schmidt :: <a href="mailto:stephan@reposita.org">stephan@reposita.org</a><br />
Reposita Open Source - Monitor your software development<br />
<a href="http://www.reposita.org" rel="nofollow">http://www.reposita.org</a><br />
Blog at <a href="http://stephan.reposita.org" rel="nofollow">http://stephan.reposita.org</a> - No signal. No noise.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will Sargent</title>
		<link>http://thediscoblog.com/2007/07/03/mocks-are-hip-when-it-comes-to-bdd/#comment-18116</link>
		<dc:creator>Will Sargent</dc:creator>
		<pubDate>Tue, 03 Jul 2007 16:04:26 +0000</pubDate>
		<guid>http://thediscoblog.com/2007/07/03/mocks-are-hip-when-it-comes-to-bdd/#comment-18116</guid>
		<description>How do mock objects get invalidate the test cases?  I don't see it.  I've seen some places where I've been tempted to change my code because EasyMock couldn't handle that particular style, but I've not found anything completely killer...</description>
		<content:encoded><![CDATA[<p>How do mock objects get invalidate the test cases?  I don&#8217;t see it.  I&#8217;ve seen some places where I&#8217;ve been tempted to change my code because EasyMock couldn&#8217;t handle that particular style, but I&#8217;ve not found anything completely killer&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
