<?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>PHP vs .Net &#187; Mocks</title>
	<atom:link href="http://www.phpvs.net/category/mocks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpvs.net</link>
	<description>ASP.Net and PHP go head to head</description>
	<lastBuildDate>Thu, 01 Jul 2010 05:52:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>.Net Mocking Frameworks &#8211; Capability Comparison</title>
		<link>http://www.phpvs.net/2009/04/25/net-mocking-frameworks-capability-comparison/</link>
		<comments>http://www.phpvs.net/2009/04/25/net-mocking-frameworks-capability-comparison/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 06:04:40 +0000</pubDate>
		<dc:creator>morgan</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Integration Testing]]></category>
		<category><![CDATA[Mocks]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://www.phpvs.net/?p=80</guid>
		<description><![CDATA[A chart form summary of some of the features, capabilities and characteristics of four of the most popular mock object frameworks used for test driven development and design with .Net projects.]]></description>
			<content:encoded><![CDATA[<p>I have a couple years of experience of TDD under my belt, but it&#039;s only recently that I&#039;ve felt like I am a relatively decent practitioner of it.  I attribute this to forcing myself to take the plunge into mocking, and the knowledge of patterns and loosely-coupled design that I&#039;ve gained from it.</p>
<p>You see, I work on a pretty large and complex ASP.Net webforms product, and tests were introduced late into the development cycle of the initial release.  We favored integration testing with real data sources over actual unit tests.  While I did write some tests, I knew that our product was not very testable by design.</p>
<p>Recently we put together a public facing API for programming against the product, that we were able to build from scratch.  This was a natural opening to apply test driven practices and start building unit tests from the get-go.  Due to the service oriented nature of the data that the product consumes, I soon found myself realizing that I needed mocks in a big way.  I gritted my teeth and dove head-first into Rhino.mocks.</p>
<p>Several weeks down the road, it was obvious that Rhino just isn&#039;t right for our environment.  The learning curve is too steep to win quick success with all our developers (and therefore by extension, our project managers).  I began looking for another framework.</p>
<p>This led me on a frustrating research mission to find the differences between frameworks without actually trying them all. Due to a lack of in-depth comparisons of the actual capabilities of the various mocking frameworks, I&#039;ve ended up putting together this chart.  I&#039;m hoping it helps some people.  My interest is very high in this arena, so I will be keeping it up to date.</p>
<p>(Just for interest&#039;s sake -- we ended up choosing Moq, due to the ease of the API.   The philosophy of Moq jives perfectly with our relatively fast-paced and efficient development environment.  We don&#039;t care about purism -- we care about getting it done.)</p>
<div id="attachment_98" class="wp-caption aligncenter" style="width: 650px"></p>
<div class="mceTemp mceIEcenter">
<dl id="attachment_101" class="wp-caption aligncenter" style="width: 650px;">
<dt class="wp-caption-dt"><img class="size-full wp-image-101" title=".Net Mocking Frameworks" src="http://www.phpvs.net/wp-content/uploads/2009/05/comparison.png" alt=".Net Mocking Framework Comparison" width="640" height="488" /><p class="wp-caption-text">.Net Mocking Framework Comparison </p></div>
</dt>
</dl>
</div>
<p style="text-align: center;"><strong>Other Notes</strong></p>
<table border="1" cellspacing="0" cellpadding="0" width="690" align="center">
<tbody>
<tr>
<td width="330" valign="top"><strong>Rhino</strong></p>
<ul class="unIndentedList">
<li> Mature, flexible framework</li>
</ul>
<ul class="unIndentedList">
<li> Built on Castle DynamicProxy</li>
</ul>
<ul class="unIndentedList">
<li> Very large array of &#034;syntaxes&#034; leads to extreme   confusion when writing tests -- documentation mixed for the new 3.5 fluent syntax</li>
</ul>
<ul class="unIndentedList">
<li> Large community of users</li>
</ul>
</td>
<td width="360" valign="top"><strong>Moq</strong></p>
<ul class="unIndentedList">
<li> New(ish) framework also built on Castle</li>
</ul>
<ul class="unIndentedList">
<li> Requires .Net 3.5 due to its lambda heavy   syntax</li>
</ul>
<ul class="unIndentedList">
<li> No distinction between mocks &amp; stubs,   record/playback (joy!!)</li>
</ul>
<ul class="unIndentedList">
<li> Responsive and active developers and community</li>
</ul>
</td>
</tr>
<tr>
<td width="330" valign="top"><strong>NMock2</strong></p>
<ul class="unIndentedList">
<li> Uses &#034;magic strings&#034; for mocking -- makes tests   brittle</li>
</ul>
<ul class="unIndentedList">
<li> Confusing product version #&#039;s -- Nmock2 is   actually a new team that picked up NMock and continued development</li>
</ul>
</td>
<td width="360" valign="top"><strong>TypeMock.Net</strong></p>
<ul class="unIndentedList">
<li> Powerful framework that uses redirection at   the IL level to create mocks</li>
</ul>
<ul class="unIndentedList">
<li> Expensive ($450/license)</li>
</ul>
<ul class="unIndentedList">
<li> TDD Purists argue that the power of it leads   to poorer design</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>The above observations were gleaned from many web pages, documentation repositories and blog posts, and reflect my limited understanding of each framework.  <em><strong> There may be errors</strong></em>.   If you think I&#039;m wrong, or you can think of other capability aspects that I&#039;ve overlooked, please let me know!</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fwww.phpvs.net%2f2009%2f04%2f25%2fnet-mocking-frameworks-capability-comparison%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.phpvs.net%2f2009%2f04%2f25%2fnet-mocking-frameworks-capability-comparison%2f&amp;bgcolor=FF9933&amp;cbgcolor=D4E1FD" border="0" alt="kick it on DotNetKicks.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpvs.net/2009/04/25/net-mocking-frameworks-capability-comparison/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
