<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>ch.harmen.blog</title>
	<atom:link href="http://hawe.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://hawe.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Wed, 28 Apr 2010 18:25:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='hawe.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>ch.harmen.blog</title>
		<link>http://hawe.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://hawe.wordpress.com/osd.xml" title="ch.harmen.blog" />
	<atom:link rel='hub' href='http://hawe.wordpress.com/?pushpress=hub'/>
		<item>
		<title>It&#8217;s official: Sis, you&#8217;re nuts and we love your for that!</title>
		<link>http://hawe.wordpress.com/2010/04/20/its-official-sis-youre-nuts-and-we-love-your-for-that/</link>
		<comments>http://hawe.wordpress.com/2010/04/20/its-official-sis-youre-nuts-and-we-love-your-for-that/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 19:17:20 +0000</pubDate>
		<dc:creator>Harmen Weber</dc:creator>
				<category><![CDATA[friends]]></category>

		<guid isPermaLink="false">http://hawe.wordpress.com/?p=47</guid>
		<description><![CDATA[Some long time ago, I posted about my sister who became the first hobo in our family. Last year she sold all her belongings, bought a bike and took off for a biking trip. She hitch-hiked up north through Germany, France, Denmark, Netherlands, England, Scotland and all the way back again. After more than 4&#8217;500 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hawe.wordpress.com&amp;blog=8755882&amp;post=47&amp;subd=hawe&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Some long time ago, I posted about my sister who became the first hobo in our family. Last year she sold all her belongings, bought a bike and took off for a biking trip. She hitch-hiked up north through Germany, France, Denmark, Netherlands, England, Scotland and all the way back again.</p>
<p>After more than 4&#8217;500 kilometers she finally had enough and came home. About 2 weeks at home she started looking for a job. We already thought it can&#8217;t be a typical one. It must be something &#8230; crazy, somehow?</p>
<p>Today, I came to know she found what she was looking for. I hope I get it right: She will work on a farm full of Scottish cows in a small town called Coglio.</p>
<p>What we thought? Ehrm, moooooh?</p>
<p>Sis, maybe you could point out little bit more clearly where that farm is in Coglio. And you could recharge your prepaid cell phone &#8230; do cell phones even have reception in Coglio?! I&#8217;m just saying&#8230;</p>
<p><a href="http://maps.google.ch/maps/ms?ie=UTF8&amp;hl=de&amp;t=h&amp;source=embed&amp;msa=0&amp;msid=101242122078154265065.000484afb1cdeda71eb8b&amp;ll=46.269525,8.684778&amp;spn=0.009315,0.022724&amp;z=16" target="_blank">Oh look! I think I just found the Scottish cows of Coglio! Mooooooh!</a></p>
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.ch/maps/ms?ie=UTF8&amp;hl=de&amp;t=h&amp;msa=0&amp;msid=101242122078154265065.000484afb1cdeda71eb8b&amp;ll=46.268664,8.684692&amp;spn=0.005192,0.00912&amp;z=16&amp;output=embed"></iframe><br /><small><a href="http://maps.google.ch/maps/ms?ie=UTF8&amp;hl=de&amp;t=h&amp;msa=0&amp;msid=101242122078154265065.000484afb1cdeda71eb8b&amp;ll=46.268664,8.684692&amp;spn=0.005192,0.00912&amp;z=16&amp;source=embed" style="text-align:left">View Larger Map</a></small>
<p> </p>
<p>Amendment to those that have the Google Earth Plugin installed: Coglio looks even nicer <a href="http://maps.google.ch/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=101242122078154265065.000484afb1cdeda71eb8b&amp;ll=46.278047,8.681796&amp;spn=0.021327,0.043731&amp;t=f&amp;z=15&amp;ecpose=46.24189077,8.69972823,1489.04,-18.921,77.565,0" target="_blank">in 3D</a>.</p>
<div id="attachment_66" class="wp-caption alignnone" style="width: 310px"><a href="http://hawe.files.wordpress.com/2010/04/coglio_with_geplugin.jpg"><img class="size-medium wp-image-66" title="coglio_with_geplugin" src="http://hawe.files.wordpress.com/2010/04/coglio_with_geplugin.jpg?w=300&#038;h=190" alt="" width="300" height="190" /></a><p class="wp-caption-text">Coglio and Cows through the goggles of the Google Earth Plugin</p></div>
<br />Filed under: <a href='http://hawe.wordpress.com/category/friends/'>friends</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hawe.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hawe.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hawe.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hawe.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hawe.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hawe.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hawe.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hawe.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hawe.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hawe.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hawe.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hawe.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hawe.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hawe.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hawe.wordpress.com&amp;blog=8755882&amp;post=47&amp;subd=hawe&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hawe.wordpress.com/2010/04/20/its-official-sis-youre-nuts-and-we-love-your-for-that/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/63e0cfcb30bfd5b558a598ddb0b1eae2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Harmen</media:title>
		</media:content>

		<media:content url="http://hawe.files.wordpress.com/2010/04/coglio_with_geplugin.jpg?w=300" medium="image">
			<media:title type="html">coglio_with_geplugin</media:title>
		</media:content>
	</item>
		<item>
		<title>Francine&#8217;s Tour</title>
		<link>http://hawe.wordpress.com/2009/07/27/francines-tour/</link>
		<comments>http://hawe.wordpress.com/2009/07/27/francines-tour/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 18:14:00 +0000</pubDate>
		<dc:creator>Harmen Weber</dc:creator>
				<category><![CDATA[friends]]></category>

		<guid isPermaLink="false">http://hawe.wordpress.com/2009/07/27/francines-tour/</guid>
		<description><![CDATA[A few days ago, my sister has left everything behind, sat on her bike and head north. Congratulations, sister, you are the first hobo in our family ;-) No, honestly, we are all jealous back here. As much as we&#8217;d love to follow your example, we know we are all too soft to stand such [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hawe.wordpress.com&amp;blog=8755882&amp;post=22&amp;subd=hawe&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-family:verdana;">A few days ago, my sister has left everything behind, sat on her bike and head north. Congratulations, sister, you are the first hobo in our family ;-)</span></p>
<p>No, honestly, we are all jealous back here. As much as we&#8217;d love to follow your example, we know we are all too soft to stand such a trip.</p>
<p>Keep sending your <a href="http://francinestour.wordpress.com/">trip reports</a>, sis! We keep track on the <a title="map" href="http://maps.google.ch/maps/ms?ie=UTF8&amp;msa=0&amp;msid=101242122078154265065.00046f6eb5114c214c0df&amp;ll=48.741701,7.965088&amp;spn=3.477753,7.03125&amp;t=p&amp;z=7&amp;source=embed" target="_blank">map</a>.</p>
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.ch/maps/ms?hl=de&amp;gl=ch&amp;ie=UTF8&amp;oe=UTF8&amp;t=p&amp;msa=0&amp;msid=101242122078154265065.00046f6eb5114c214c0df&amp;ll=48.217353,7.866211&amp;spn=1.756881,3.515625&amp;z=8&amp;output=embed"></iframe><br /><small><a href="http://maps.google.ch/maps/ms?hl=de&amp;gl=ch&amp;ie=UTF8&amp;oe=UTF8&amp;t=p&amp;msa=0&amp;msid=101242122078154265065.00046f6eb5114c214c0df&amp;ll=48.217353,7.866211&amp;spn=1.756881,3.515625&amp;z=8&amp;source=embed" style="text-align:left">View Larger Map</a></small>
<br />Posted in friends  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hawe.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hawe.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hawe.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hawe.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hawe.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hawe.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hawe.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hawe.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hawe.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hawe.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hawe.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hawe.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hawe.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hawe.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hawe.wordpress.com&amp;blog=8755882&amp;post=22&amp;subd=hawe&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hawe.wordpress.com/2009/07/27/francines-tour/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/63e0cfcb30bfd5b558a598ddb0b1eae2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Harmen</media:title>
		</media:content>
	</item>
		<item>
		<title>Moving a Subversion Repository</title>
		<link>http://hawe.wordpress.com/2008/09/04/moving-a-subversion-repository/</link>
		<comments>http://hawe.wordpress.com/2008/09/04/moving-a-subversion-repository/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 20:22:00 +0000</pubDate>
		<dc:creator>Harmen Weber</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://hawe.wordpress.com/2008/09/04/moving-a-subversion-repository/</guid>
		<description><![CDATA[Follow the steps: Execute the command below to get a dump of all committed changes on the specified repository: svnadmin dump /path/to/repository &#62; repository-name.dump Compress the dump using: gzip repository-name.dump Move the dump to your target location Decompress the dump gunzip repository-name.dump.gz In case you have not yet created a repository at your target location: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hawe.wordpress.com&amp;blog=8755882&amp;post=21&amp;subd=hawe&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:100%;">Follow the steps:<br /></span>
<ol>
<li><span style="font-size:100%;">Execute the command below to get a dump of all committed changes on the specified repository:<br /></span>
<pre><span style="font-size:100%;"><code>svnadmin dump /path/to/repository &gt; repository-name.dump</code></span></pre>
</li>
<li><span style="font-size:100%;">Compress the dump using:<br /></span>
<pre><span style="font-size:100%;"><code>gzip </code><code>repository-name.dump</code></span></pre>
</li>
<li><span style="font-size:100%;">Move the dump to your target location<br /></span></li>
<li><span style="font-size:100%;">Decompress the dump<br /></span>
<pre><span style="font-size:100%;"><code>gunzip </code><code>repository-name.dump.gz</code></span></pre>
</li>
<li><span style="font-size:100%;">In case you have not yet created a repository at your target location:</span>
<pre><span style="font-size:100%;"><code>svnadmin create target-repository</code></span></pre>
</li>
<li><span style="font-size:100%;">Apply the dumped commits to your target repository:<br /></span>
<pre><span style="font-size:100%;"><code>svnadmin load </code><code>target-repository</code> <code>&lt; </code></span><span style="font-size:100%;"><code>repository-name.dump</code></span></pre>
</li>
</ol>
<p><span style="font-size:100%;">Done.</span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hawe.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hawe.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hawe.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hawe.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hawe.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hawe.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hawe.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hawe.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hawe.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hawe.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hawe.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hawe.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hawe.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hawe.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hawe.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hawe.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hawe.wordpress.com&amp;blog=8755882&amp;post=21&amp;subd=hawe&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hawe.wordpress.com/2008/09/04/moving-a-subversion-repository/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/63e0cfcb30bfd5b558a598ddb0b1eae2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Harmen</media:title>
		</media:content>
	</item>
		<item>
		<title>Of Snakes and Tigers</title>
		<link>http://hawe.wordpress.com/2008/04/20/of-snakes-and-tigers/</link>
		<comments>http://hawe.wordpress.com/2008/04/20/of-snakes-and-tigers/#comments</comments>
		<pubDate>Sun, 20 Apr 2008 09:34:00 +0000</pubDate>
		<dc:creator>Harmen Weber</dc:creator>
				<category><![CDATA[friends]]></category>

		<guid isPermaLink="false">http://hawe.wordpress.com/2008/04/20/of-snakes-and-tigers/</guid>
		<description><![CDATA[That&#8217;s Grisgris. He might look a bit chubby and dumpy &#8230; and dozily &#8230; and maybe even a bit lazy. But whenever he&#8217;s not dreaming of fresh tuna slices, grilled rabbit chops or tandoori mutton, he releases his inner tiger. Birds, mice, bugs and spiders cover our trophy wall. His newest acquisition and his (or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hawe.wordpress.com&amp;blog=8755882&amp;post=20&amp;subd=hawe&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://1.bp.blogspot.com/_S1Nz_WC0S2c/SAsVOuslD6I/AAAAAAAACxk/j8kRzGGsQQE/s1600/OfSnakesAndTigers_01.jpg"><img src="http://1.bp.blogspot.com/_S1Nz_WC0S2c/SAsVOuslD6I/AAAAAAAACxk/j8kRzGGsQQE/s320/OfSnakesAndTigers_01.jpg" alt="" border="0" width="180" /></a>That&#8217;s Grisgris. He might look a bit chubby and dumpy &#8230; and dozily &#8230; and maybe even a bit lazy.</p>
<p><a href="http://3.bp.blogspot.com/_S1Nz_WC0S2c/SAsVUOslD7I/AAAAAAAACxs/LodOwJuxPB4/s1600/OfSnakesAndTigers_02.jpg"><img src="http://3.bp.blogspot.com/_S1Nz_WC0S2c/SAsVUOslD7I/AAAAAAAACxs/LodOwJuxPB4/s320/OfSnakesAndTigers_02.jpg" alt="" border="0" width="180" /></a>But whenever he&#8217;s not dreaming of fresh tuna slices, grilled rabbit chops or tandoori mutton, he releases his inner tiger. Birds, mice, bugs and spiders cover our trophy wall. His newest acquisition and his (or should I say &#8216;our&#8217;) pride and joy is this little snake &#8230; I didn&#8217;t even know we had snakes here.</p>
<p><a href="http://1.bp.blogspot.com/_S1Nz_WC0S2c/SAswiuslD-I/AAAAAAAACyE/fgJvM2B5IFI/s1600/OfSnakesAndTigers_03.jpg"><img src="http://1.bp.blogspot.com/_S1Nz_WC0S2c/SAswiuslD-I/AAAAAAAACyE/fgJvM2B5IFI/s320/OfSnakesAndTigers_03.jpg" alt="" border="0" width="180" /></a>So, does anyone have an idea what snake that is?  <span><b></p>
<p></b></span><br /><span><b></p>
<p></b></span><a href="http://3.bp.blogspot.com/_S1Nz_WC0S2c/SAsw1OslD_I/AAAAAAAACyM/GeBuYIVpGyE/s1600/OfSnakesAndTigers_04.jpg"><img src="http://3.bp.blogspot.com/_S1Nz_WC0S2c/SAsw1OslD_I/AAAAAAAACyM/GeBuYIVpGyE/s320/OfSnakesAndTigers_04.jpg" alt="" border="0" width="180" /></a><span><b>What is your pet&#8217;s latest acquisition on your </b></span><span><b>trophy wall?</b></span> <span style="text-decoration:underline;"><br /></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hawe.wordpress.com/20/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hawe.wordpress.com/20/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hawe.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hawe.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hawe.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hawe.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hawe.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hawe.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hawe.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hawe.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hawe.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hawe.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hawe.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hawe.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hawe.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hawe.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hawe.wordpress.com&amp;blog=8755882&amp;post=20&amp;subd=hawe&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hawe.wordpress.com/2008/04/20/of-snakes-and-tigers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/63e0cfcb30bfd5b558a598ddb0b1eae2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Harmen</media:title>
		</media:content>

		<media:content url="http://1.bp.blogspot.com/_S1Nz_WC0S2c/SAsVOuslD6I/AAAAAAAACxk/j8kRzGGsQQE/s320/OfSnakesAndTigers_01.jpg" medium="image" />

		<media:content url="http://3.bp.blogspot.com/_S1Nz_WC0S2c/SAsVUOslD7I/AAAAAAAACxs/LodOwJuxPB4/s320/OfSnakesAndTigers_02.jpg" medium="image" />

		<media:content url="http://1.bp.blogspot.com/_S1Nz_WC0S2c/SAswiuslD-I/AAAAAAAACyE/fgJvM2B5IFI/s320/OfSnakesAndTigers_03.jpg" medium="image" />

		<media:content url="http://3.bp.blogspot.com/_S1Nz_WC0S2c/SAsw1OslD_I/AAAAAAAACyM/GeBuYIVpGyE/s320/OfSnakesAndTigers_04.jpg" medium="image" />
	</item>
		<item>
		<title>About the Scope of Unit Tests</title>
		<link>http://hawe.wordpress.com/2008/03/23/about-the-scope-of-unit-tests/</link>
		<comments>http://hawe.wordpress.com/2008/03/23/about-the-scope-of-unit-tests/#comments</comments>
		<pubDate>Sun, 23 Mar 2008 23:13:00 +0000</pubDate>
		<dc:creator>Harmen Weber</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://hawe.wordpress.com/2008/03/23/about-the-scope-of-unit-tests/</guid>
		<description><![CDATA[Most unit tests I have seen and created so far had the wrong test scope. They depended on having the involved units/components to be integrated already and further they depended on the units/component to be implemented correctly. They were in fact more like integration tests rather than unit tests. Let me summarize my today&#8217;s thoughts [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hawe.wordpress.com&amp;blog=8755882&amp;post=19&amp;subd=hawe&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:85%;"><span style="font-family:verdana;">Most unit tests I have seen and created so far had the wrong test scope. They depended on having the involved units/components to be integrated already and further they depended on the units/component to be implemented correctly. They were in fact more like integration tests rather than unit tests. Let me summarize my today&#8217;s thoughts about what the right scope of unit tests should be. Let me point out my current understanding of</span></span><span style="font-size:85%;"><span style="font-family:verdana;"> t</span>he purpose and therefore the scope of unit tests.</p>
<p></span><span style="font-size:85%;"><span style="font-family:verdana;">On <a href="http://www.wikipedia.org/">Wikipedia</a> I could find the following regarding unit tests:</span> </span><br />
<blockquote><span style="font-size:85%;">In computer programming, unit testing is a procedure used to validate that individual units of source code are working properly. A unit is the smallest testable part of an application. In procedural programming a unit may be an individual program, function, procedure, etc., while in object-oriented programming, the smallest unit is a method, which may belong to a base/super class, abstract class or derived/child class.</span></p></blockquote>
<p><span style="font-size:85%;"><span style="font-family:verdana;"><br />And although I&#8217;ve heard so many agreeing on this definition and claiming to have understood and applied it, I also saw tons of unit tests in my daily work that proof the opposite.</span></p>
<p></span><br />
<h3><span style="font-size:85%;"><span style="font-family:verdana;">Example</span></span></h3>
<p><span style="font-size:85%;"><span style="font-family:verdana;">Let&#8217;s look at a very simple scenario to discuss the correct scope of unit tests:</span>  <span style="font-family:verdana;">Let&#8217;s assume we have a very simple partner management module that is split into two layers:</span> </span>
<ul style="font-family:verdana;">
<li><span style="font-size:85%;">an <b>integration service layer</b> that provides integration services through data access objects.<br />In our particular case, the integration service layer holds a PartnerDao and a RoleDao to persist and retrieve Partner and Role entities.<br /></span></li>
<li><span style="font-size:85%;">a <b>domain service layer</b> that provides domain services for our partner management domain.<br />In our particular case, the domain service layer consists of a single PartnerManagement service providing methods to work on/with the partner management domain and it&#8217;s domain entities Partner and Role.</span></li>
</ul>
<p><span style="font-size:85%;">The business in the partner management domain service layer is rather simple, most methods provided by the PartnerManagement service just validate the input data and then delegate to the corresponding DAO of the integration service layer.<br /></span><br /><span style="font-size:85%;">Let&#8217;s take a look at the sequence diagram of the exemplary createPartner(&#8230;)  method provided by the PartnerManagement service.</span><span style="font-size:85%;"></p>
<p></span><a href="http://1.bp.blogspot.com/_S1Nz_WC0S2c/R-6WFOiQaaI/AAAAAAAACw0/CNvL--0O4Jw/s1600/PartnerManagement_createPartner_sequence.png"><img src="http://1.bp.blogspot.com/_S1Nz_WC0S2c/R-6WFOiQaaI/AAAAAAAACw0/CNvL--0O4Jw/s400/PartnerManagement_createPartner_sequence.png" alt="" border="0" /></a><span style="font-size:85%;"><br />The important thing when unit testing the application is (and that&#8217;s what I feel is often misunderstood and not followed properly) that each unit must be tested independently. To test a unit means to ensure that the unit is working properly, disregarding any other involved units and their business logic.</p>
<p>The unit tests for unit <i>A</i><br /></span>
<ul>
<li><span style="font-size:85%;">must </span><span style="font-size:85%;">test all business logic of unit <i>A</i><i>,</i></span><br /><span style="font-size:85%;"><i>   to ensure the unit A has been realized correctly!</i></span></li>
<li><span style="font-size:85%;">must be independent of any other involved units</span><span style="font-size:85%;"><br /><i>   to ensure we test the business of unit A only</i></span><span style="font-size:85%;"><br /><i>   so that we have a clear test scope, it must be absolutely clear what gets tested where</i></span><span style="font-size:85%;"><br /></span></li>
<li><span style="font-size:85%;">i.e. it must not test any business logic of any other involved units,<br /><i>   to ensure that other units can change their business logic back and forth<br /> but our unit tests for unit A remain accurate and successful</i><br /></span></li>
<li><span style="font-size:85%;">and it must not depend on the the other units to work properly<br /><i>   to ensure that the unit tests of unit A are still successful even when other units break</i><br /></span></li>
</ul>
<p><span style="font-size:85%;"><br />The unit test for the PartnerManagement.createPartner(&#8230;) method could look as follows:</p>
<p>source: <a title="PartnerManagementTest_01.java" href="http://harmen.weber.googlepages.com/PartnerManagementIntegrationTest.java" id="n43v">PartnerManagementIntegrationTest.java</a>
<div class="java" align="left"> <br />
<table border="0" cellpadding="3" cellspacing="0" width="420" style="color:#ffffff;">
<tbody>
<tr>
<td align="left" nowrap="nowrap" valign="top"> <code><span style="font-size:85%;color:#7f0055;"><b><span style="font-family:monospace;">p</span>rivate </b></span><span style="font-size:85%;color:#000000;">ApplicationContext applicationContext = </span><span style="font-size:85%;color:#7f0055;"><b>null</b></span><span style="font-size:85%;color:#000000;">;</span><span style="font-size:85%;"><br /></span><span style="font-size:85%;color:#7f0055;"><b>private </b></span><span style="font-size:85%;color:#000000;">PartnerManagement partnerManagement = </span><span style="font-size:85%;color:#7f0055;"><b>null</b></span><span style="font-size:85%;">;</p>
<p></span><span style="font-size:85%;color:#646464;">@Before</span><span style="font-size:85%;"><br /></span><span style="font-size:85%;color:#7f0055;"><b>public </b></span><span style="font-size:85%;color:#7f0055;"><b>void </b></span><span style="font-size:85%;color:#000000;">setUp</span><span style="font-size:85%;color:#000000;">() </span><span style="font-size:85%;color:#7f0055;"><b>throws </b></span><span style="font-size:85%;color:#000000;">Exception </span><span style="font-size:85%;color:#000000;">{</span><span style="font-size:85%;"><br /></span></code>
<div style="margin-left:40px;"><span style="font-size:85%;"><code><span style="color:#000000;">applicationContext = </span><span style="color:#7f0055;"><b><br /></b></span></code></span>
<div style="margin-left:40px;"><span style="font-size:78%;"><code><span style="font-size:85%;color:#7f0055;"><b>new </b></span><span style="font-size:85%;color:#000000;">ClassPathXmlApplicationContext</span><span style="font-size:85%;color:#000000;">(</span><span style="color:#2a00ff;"><br /></span></code></span>
<div style="margin-left:40px;"><span style="font-size:78%;"><code><span style="color:#2a00ff;">"ch/harmen/partnermanagement/bus/application-context.xml"</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span></code><br /></span></div>
</div>
<p><span style="font-size:85%;"><code><span style="color:#000000;">partnerManagement = </span><span style="color:#000000;"><br /></span></code></span>
<div style="margin-left:40px;"><span style="font-size:85%;"><code><span style="color:#000000;">(</span><span style="color:#000000;">PartnerManagement</span><span style="color:#000000;">) </span><span style="color:#000000;">applicationContext.getBean</span><span style="color:#000000;">(<br /></span></code></span>
<div style="margin-left:40px;"><span style="font-size:78%;"><span style="font-size:85%;"><code><span style="color:#2a00ff;">"ch.harmen.partnermanagement.bus.PartnerManagement"</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span></code></span><br /></span></div>
</div>
</div>
<p><span style="font-size:85%;"><code><span style="color:#000000;">}</span></code></span></td>
</tr>
</tbody>
</table>
<table style="color:rgb(255,255,255);" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr><span style="font-size:78%;"></p>
<p></span>
<td align="left" nowrap="nowrap" valign="top"><span style="font-size:85%;"><code><span style="color:rgb(63,95,191);">/**</span><br /> <span style="color:rgb(63,95,191);">* Test the createPartner service:</span><br /> <span style="color:rgb(63,95,191);">*     asserts that a valid partner gets created successfully</span><br /> <span style="color:rgb(63,95,191);">*/</span><br /><span style="color:rgb(100,100,100);">@Test</span><br /><span style="color:rgb(127,0,85);"><b>public </b></span><span style="color:rgb(127,0,85);"><b>void </b></span><span style="color:rgb(0,0,0);">testCreateAndFindPartner_02</span><span style="color:rgb(0,0,0);">() {</span><br /></code></span>
<div style="margin-left:40px;"><span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// Create test partner </span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// Since we have already integrated the real implementation<br />// of CreatePartnerValidator,</span></code> <code><span style="color:rgb(63,127,95);">we have to create valid input data<br />// otherwise the creation will fail (which is not intended in this case).</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// This implies that this unit tests knows the business<br />// of the CreatePartnerValidator, i.e. the unit </span></code><code><span style="color:rgb(63,127,95);">must know what a<br />// valid partner is.</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// In case the validation business logic changes,<br />// it might be that this unit test must be changed also,</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// since the data passed here is not valid anymore after the change.</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">String firstname = </span><span style="color:rgb(42,0,255);">"Harmen"</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">String name = </span><span style="color:rgb(42,0,255);">"Weber"</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">String email = </span><span style="color:rgb(42,0,255);">"harmen.weber@gmail.com"</span><span style="color:rgb(0,0,0);">;</span></code></p>
<p>  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// Assert that test partner does not yet exist</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">Partner returnedPartner = partnerManagement.findPartnerByEmail</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">email</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">assertNull</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">returnedPartner</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code></p>
<p>  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// Create the test partner</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// Asserts that after creation of the test partner,<br />//     the test partner has got an ID</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// and asserts that the attributes are correct.</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">returnedPartner = partnerManagement.createPartner</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">firstname, name, email</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">assertNotNull</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">returnedPartner</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">assertNotNull</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">returnedPartner.getId</span><span style="color:rgb(0,0,0);">())</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">assertEquals</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">firstname, returnedPartner.getFirstname</span><span style="color:rgb(0,0,0);">())</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">assertEquals</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">name, returnedPartner.getName</span><span style="color:rgb(0,0,0);">())</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">assertEquals</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">email, returnedPartner.getEmail</span><span style="color:rgb(0,0,0);">())</span><span style="color:rgb(0,0,0);">;</span></code></p>
<p>  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// assert that the test partner was created successfully</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">returnedPartner = partnerManagement.findPartnerByEmail</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">email</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">assertNotNull</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">returnedPartner</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">assertNotNull</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">returnedPartner.getId</span><span style="color:rgb(0,0,0);">())</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">assertEquals</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">firstname, returnedPartner.getFirstname</span><span style="color:rgb(0,0,0);">())</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">assertEquals</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">name, returnedPartner.getName</span><span style="color:rgb(0,0,0);">())</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:78%;"><span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">assertEquals</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">email, returnedPartner.getEmail</span><span style="color:rgb(0,0,0);">())</span><span style="color:rgb(0,0,0);">;</span></code></span><br /></span></div>
<p>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">}</span></code></span></td>
</tr>
</tbody>
</table>
<p></div>
<p><span style="font-family:verdana;">What I want to point out here is that the &#8216;unit test&#8217; above is not really testing the unit itself. It is doing a lot more than that.<br /><span style="font-family:verdana;">The &#8216;unit test&#8217; </span></span> </span>
<ul>
<li><span style="font-size:85%;">requires the application context configuration to be correct &#8230; it actually tests it to some extent</span></li>
<li><span style="font-size:85%;">requires the PartnerValidationHelper</span></li>
<li><span style="font-size:85%;">requires the PartnerValidationHelper to be realized correctly<br /></span></li>
<li><span style="font-family:verdana;font-size:85%;">requires the PartnerDao</span></li>
<li><span style="font-family:verdana;font-size:85%;">expects the PartnerDao to be realized correctly</span></li>
</ul>
<p><span style="font-family:verdana;font-size:85%;"><br />To make it short: this &#8216;unit test&#8217; is far away from testing the unit PartnerManagement.createPartner(&#8230;) itself.<br /></span>
<ul style="font-family:verdana;">
<li><span style="font-family:verdana;font-size:85%;">It depends on having the involved units integrated,<br /><i>   i.e. it will break once the integration contains errors</i><br /></span></li>
<li><span style="font-family:verdana;font-size:85%;">It even depends on the involved units to be realized correctly,<br /><i>   i.e. it will break once the other units break</i><br /></span></li>
<li><span style="font-family:verdana;font-size:85%;">And even worse, it claims to know the business logic of the involved units,<br /><i>   i.e. it will break once the business logic of the other unit changes</i><br /></span></li>
</ul>
<h3><span style="font-family:verdana;font-size:85%;">Identifying Unit Test&#8217;s Real Scope<br /></span></h3>
<p><span style="font-family:verdana;font-size:85%;">Let&#8217;s go back to the sequence diagram (see above) and analyse what the business logic and therefore the test scope of the unit PartnerManagement.createPartner(&#8230;) really is:</p>
<p><span style="font-family:verdana;">The unit does nothing more than </span> </span>
<ul style="font-family:verdana;">
<li><span style="font-size:85%;">first, calling the unit PartnerValidationHelper.validatePartner(&#8230;)</span></li>
<ul>
<li><span style="font-size:85%;">passing the correct partner information, equal to what was passed in the first place<br /></span></li>
</ul>
<li><span style="font-size:85%;">second, calling the unit PartnerDao.createPartner(&#8230;)</span></li>
<ul>
<li><span style="font-size:85%;">in case the validation was successful</span></li>
<li><span style="font-size:85%;">passing the correct partner information, equal to what was passed in the first place<br /></span></li>
</ul>
<li><span style="font-size:85%;">thirdly, to return whatever the PartnerDao.createPartner(&#8230;) has returned</span></li>
<ul>
<li><span style="font-size:85%;">still in case the validation was successful</span></li>
<li><span style="font-size:85%;">without making any further modifications/validations/whatever</span></li>
</ul>
</ul>
<p><span style="font-size:85%;"><span style="font-family:verdana;">that&#8217;s it and that&#8217;s all that must be tested, no more and no less.</p>
<p>How can that be achieved? An answer to that is the <a href="http://www.jmock.org/">jMock</a> library. With jMock, mock objects can be created. During the unit test, these mock objects are created and injected to the unit that is about to get unit tested. Like that the unit test does not depend on a correctly integrated application and further it does not depend on other involved units to be correctly realized.<br />Further, jMock provides the possibility to define expectations about how these mock objects are expected to be used by the unit and how the mock objects must behave when used. Like that, the behavior of involved units can be simulated, e.g. an involved validation unit can be simulated to return validation </span></span><span style="font-size:85%;"><span style="font-family:verdana;">errors</span></span><span style="font-size:85%;"><span style="font-family:verdana;"> or to not return validation errors.</p>
<p>The following code snippet shows a unit test that does not depend on having all involved units integrated properly. Further it does not depend on the involved units to be realized correctly and won&#8217;t break on changes of the business logic of the involved units:</p>
<p>source: <a title="PartnerManagementTest_02.java" href="http://harmen.weber.googlepages.com/PartnerManagementImplTest.java" id="exl:">PartnerManagementTest.java</a>
<div class="java" align="left">
<table style="color:rgb(255,255,255);" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<td align="left" nowrap="nowrap" valign="top"><span style="font-size:85%;"><code><span style="color:rgb(63,95,191);">/**</span><br /> <span style="color:rgb(63,95,191);">* Test the createPartner service:</span><br /> <span style="color:rgb(63,95,191);">*     assumes validation successful</span><br /> <span style="color:rgb(63,95,191);">* and  asserts that the call gets correctly delegated to the PartnerDao</span><br /> <span style="color:rgb(63,95,191);">* and   asserts that the partner returned by the PartnerDao gets returned unchanged.</span><br /> <span style="color:rgb(63,95,191);">*/</span><br /><span style="color:rgb(100,100,100);">@Test</span><br /><span style="color:rgb(127,0,85);"><b>public </b></span><span style="color:rgb(127,0,85);"><b>void </b></span><span style="color:rgb(0,0,0);">testCreatePartner_01</span><span style="color:rgb(0,0,0);">() {</span><br />  </code></span>
<div style="margin-left:40px;"><span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// create a jMock context</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">Mockery context = </span><span style="color:rgb(127,0,85);"><b>new </b></span><span style="color:rgb(0,0,0);">Mockery</span><span style="color:rgb(0,0,0);">()</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// create mock objects</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(127,0,85);"><b>final </b></span><span style="color:rgb(0,0,0);">PartnerDao partnerDaoMock = context.mock</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">PartnerDao.</span><span style="color:rgb(127,0,85);"><b>class</b></span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(127,0,85);"><b>final </b></span><span style="color:rgb(0,0,0);">CreatePartnerValidator createPartnerValidator =<br /></span></code></span>
<div style="margin-left:40px;"><span style="font-size:78%;"><code><span style="color:rgb(0,0,0);">context.mock</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">CreatePartnerValidator.</span><span style="color:rgb(127,0,85);"><b>class</b></span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br /></span></div>
<p>      <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// inject mock objects into partnerManagement service</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">partnerManagement.setPartnerDao</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">partnerDaoMock</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">partnerManagement.setCreatePartnerValidator</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">createPartnerValidator</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code></p>
<p>  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// define test data</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(127,0,85);"><b>final </b></span><span style="color:rgb(0,0,0);">String firstname = </span><span style="color:rgb(42,0,255);">"Harmen"</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(127,0,85);"><b>final </b></span><span style="color:rgb(0,0,0);">String name = </span><span style="color:rgb(42,0,255);">"Weber"</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(127,0,85);"><b>final </b></span><span style="color:rgb(0,0,0);">String email = </span><span style="color:rgb(42,0,255);">"harmen.weber@gmail.com"</span><span style="color:rgb(0,0,0);">;</span></code></p>
<p>  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// define what we expect to get instantiated<br />// and passed to the createPartnerValidator and partnerDao</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(127,0,85);"><b>final </b></span><span style="color:rgb(0,0,0);">Partner partnerToBePassed = </span><span style="color:rgb(127,0,85);"><b>new </b></span><span style="color:rgb(0,0,0);">PartnerImpl</span><span style="color:rgb(0,0,0);">()</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">partnerToBePassed.setEmail</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">email</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">partnerToBePassed.setFirstname</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">firstname</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">partnerToBePassed.setName</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">name</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code></p>
<p>  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// define the return value that should be returned by the createPartnerValidator</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// we do not add any validation errors to the validation result,<br />//so the validation will be successful</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">ValidationResults validationResults = </span><span style="color:rgb(127,0,85);"><b>new </b></span><span style="color:rgb(0,0,0);">ValidationResults</span><span style="color:rgb(0,0,0);">()</span><span style="color:rgb(0,0,0);">;</span></code></p>
<p>  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// define the return value that should be returned by the mockPartnerDao</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(127,0,85);"><b>final </b></span><span style="color:rgb(0,0,0);">PartnerImpl mockedPartner = </span><span style="color:rgb(127,0,85);"><b>new </b></span><span style="color:rgb(0,0,0);">PartnerImpl</span><span style="color:rgb(0,0,0);">()</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">mockedPartner.setId</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(127,0,85);"><b>new </b></span><span style="color:rgb(0,0,0);">Long</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(153,0,0);">72</span><span style="color:rgb(0,0,0);">))</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">mockedPartner.setEmail</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">email</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">mockedPartner.setFirstname</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">firstname</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">mockedPartner.setName</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">name</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code></p>
<p>  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// define sequence of delegated calls to createPartnerValidator and partnerDao</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(127,0,85);"><b>final </b></span><span style="color:rgb(0,0,0);">Sequence createPartnerSequence = context.sequence</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(42,0,255);">"createPartnerSequence"</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code></p>
<p>  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// define expectations regarding calls to createPartnerValidator and partnerDao</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">context.checking</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(127,0,85);"><b>new </b></span><span style="color:rgb(0,0,0);">Expectations</span><span style="color:rgb(0,0,0);">() {{</span></code><br />    </span>
<div style="margin-left:40px;"><span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// validate service to be called once<br />// with a partner containing the correct attributes</span></code><br />    </span>      <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">one</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">createPartnerValidator</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">.validate</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">partnerToBePassed</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />    </span>      <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">inSequence</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">createPartnerSequence</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />    </span>      <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// createPartner service to be called<br />// with a partner containing the correct attributes</span></code><br />    </span>      <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">one</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">partnerDaoMock</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">.createPartner</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">partnerToBePassed</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />    </span>      <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">i</span></code></span><span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">nSequence</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">createPartnerSequence</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />    </span>      <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// partnerDaoMock to return the mockedPartner object</span></code><br />    </span>      <span style="font-size:78%;"><span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">will</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">returnValue</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">mockedPartner</span><span style="color:rgb(0,0,0);">))</span><span style="color:rgb(0,0,0);">;</span></code></span><br />  </span>    </div>
<p><span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">}})</span><span style="color:rgb(0,0,0);">;</span></code></p>
<p>  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// call service</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">Partner returnedPartner = partnerManagement.createPartner</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">firstname, name, email</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// assert expectations to be fulfilled</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">context.assertIsSatisfied</span><span style="color:rgb(0,0,0);">()</span><span style="color:rgb(0,0,0);">;</span></code><br /><code><span style="color:rgb(63,127,95);">// assert returnedPartner, in this trivial case,<br />// we expect the partnerManagement to not have changed any</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// values on the mockedPartner returned by the partnerDaoMock.</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// In another scenario/service, maybe the partnerManagement<br />// must do some calculations and change/set</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(63,127,95);">// some attributes on the mockedPartner returned by the partnerDaoMock</span></code><br />  </span>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">assertEquals</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">mockedPartner.getId</span><span style="color:rgb(0,0,0);">()</span><span style="color:rgb(0,0,0);">, returnedPartner.getId</span><span style="color:rgb(0,0,0);">())</span><span style="color:rgb(0,0,0);">;</span></code><br />  </span>  <span style="font-size:78%;"><span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">assertEquals</span><span style="color:rgb(0,0,0);">(</span><span style="color:rgb(0,0,0);">mockedPartner, returnedPartner</span><span style="color:rgb(0,0,0);">)</span><span style="color:rgb(0,0,0);">;</span></code></span><br /></span></div>
<p>  <span style="font-size:85%;"><code><span style="color:rgb(0,0,0);">}</span></code></span></td>
</tr>
<p></tbody>
</table>
<p>
<h3>Summary</h3>
<p>Be aware about the correct scope of your unit tests: A unit is the smallest testable part of an application that can be tested independently. Your unit tests must not depend a proper integration of involved units and they must not depend on the correct realization of involved units. Use mock objects (e.g. <span style="font-size:85%;"><span style="font-family:verdana;"><a href="http://www.jmock.org/">jMock</a>) </span></span><span style="font-size:85%;"><span style="font-family:verdana;">to unit test your units independently. The benefit of having independent unit tests (i.e. unit tests with the correct scope: only the unit itself) is </span></span><span style="font-size:85%;"><span style="font-family:verdana;">to have more stable unit tests</span></span> with the same coverage and the guarantee that in case of changes to the business logic of a unit only unit tests of the changed unit will have to be updated.</div>
<p></span></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hawe.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hawe.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hawe.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hawe.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hawe.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hawe.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hawe.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hawe.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hawe.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hawe.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hawe.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hawe.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hawe.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hawe.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hawe.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hawe.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hawe.wordpress.com&amp;blog=8755882&amp;post=19&amp;subd=hawe&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hawe.wordpress.com/2008/03/23/about-the-scope-of-unit-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/63e0cfcb30bfd5b558a598ddb0b1eae2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Harmen</media:title>
		</media:content>

		<media:content url="http://1.bp.blogspot.com/_S1Nz_WC0S2c/R-6WFOiQaaI/AAAAAAAACw0/CNvL--0O4Jw/s400/PartnerManagement_createPartner_sequence.png" medium="image" />
	</item>
	</channel>
</rss>
