<?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>uxebu » blog &#187; testing</title>
	<atom:link href="http://uxebu.com/tag/testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://uxebu.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 23 Apr 2012 19:10:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>To mock or not to mock</title>
		<link>http://uxebu.com/blog/2012/04/04/to-mock-or-not-to-mock/</link>
		<comments>http://uxebu.com/blog/2012/04/04/to-mock-or-not-to-mock/#comments</comments>
		<pubDate>Wed, 04 Apr 2012 17:45:57 +0000</pubDate>
		<dc:creator>Wolfram Kriesing</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[jasmine]]></category>
		<category><![CDATA[mock]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://uxebu.com/blog/?p=2322</guid>
		<description><![CDATA[I am just hacking along, all TDD style of course, and the one problem I always come across again is to realize when I should mock and when not. My current idea is to have two blocks of tests, one with mocked data, the other non-mocking. Let me lead you to why I came up [...]]]></description>
			<content:encoded><![CDATA[<p>I am just hacking along, all TDD style of course, and the one problem I always come across again is to realize when I should mock and when not. My current idea is to have two blocks of tests, one with mocked data, the other non-mocking. Let me lead you to why I came up with that. Input and discussion welcome, I am curious about ideas and possible improvements.<br />
<span id="more-2322"></span></p>
<h2>The task</h2>
<p>I have a set of methods and want to find out if they are implemented. See the code below, sorted in logical order.</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span style="color: #006600; font-style: italic;">// The big summary method, that spits out the final result.</span><br />
&nbsp; <span style="color: #003366; font-weight: bold;">function</span> forMethods<span style="color: #009900;">&#40;</span>methods<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; numTotal<span style="color: #339933;">:</span> methods.<span style="color: #660066;">length</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; numImplemented<span style="color: #339933;">:</span> getNumberOfImplementedMethods<span style="color: #009900;">&#40;</span>methods<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #003366; font-weight: bold;">function</span> getNumberOfImplementedMethods<span style="color: #009900;">&#40;</span>methods<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// some simple map+reduce using `isMethodImplemented()`</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #003366; font-weight: bold;">function</span> isMethodImplemented<span style="color: #009900;">&#40;</span>method<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> details <span style="color: #339933;">=</span> getMethodDetails<span style="color: #009900;">&#40;</span>method<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> details.<span style="color: #660066;">exists</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>details.<span style="color: #660066;">isDummy</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #003366; font-weight: bold;">function</span> getMethodDetails<span style="color: #009900;">&#40;</span>method<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; exists<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">typeof</span> method <span style="color: #339933;">==</span> <span style="color: #3366CC;">'function'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; isDummy<span style="color: #339933;">:</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">+</span>method <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">+</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>And the tests for <code class="codecolorer text mac-classic"><span class="text">forMethods()</span></code> as the user expects it to work, without mocking (or spying).</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">describe<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'forMethods (no mocking)'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; it<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'should return {numTotal:1, numImplemented:1}'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> actual <span style="color: #339933;">=</span> summary.<span style="color: #660066;">forMethods</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> expected <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>numTotal<span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> numImplemented<span style="color: #339933;">:</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; expect<span style="color: #009900;">&#40;</span>actual<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toEqual</span><span style="color: #009900;">&#40;</span>expected<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; it<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'should return {numTotal:0, numImplemented:0}'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> actual <span style="color: #339933;">=</span> summary.<span style="color: #660066;">forMethods</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> expected <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>numTotal<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> numImplemented<span style="color: #339933;">:</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; expect<span style="color: #009900;">&#40;</span>actual<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toEqual</span><span style="color: #009900;">&#40;</span>expected<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>This works fine as long as I don&#8217;t change any of the underlying functions or a requirement that is implemented in some function other than the <code class="codecolorer text mac-classic"><span class="text">forMethods()</span></code> function that I have tests for. For example, I define a dummyFunction myself <code class="codecolorer text mac-classic"><span class="text">var dummyFunction = function(){ console.warn('not implemented') }</span></code> to allow also <code class="codecolorer text mac-classic"><span class="text">function(){}</span></code> to be a valid method, which was not the case yet. I change the first test to</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; it<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'should return {numTotal:1, numImplemented:1}'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// Before there was `function(){ return 1 }` in the line below.</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> actual <span style="color: #339933;">=</span> summary.<span style="color: #660066;">forMethods</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> expected <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>numTotal<span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> numImplemented<span style="color: #339933;">:</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; expect<span style="color: #009900;">&#40;</span>actual<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toEqual</span><span style="color: #009900;">&#40;</span>expected<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>and add a new test</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; it<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'should return {numTotal:1, numImplemented:0} for a dummy function'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> actual <span style="color: #339933;">=</span> summary.<span style="color: #660066;">forMethods</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>summary.<span style="color: #660066;">dummyFunction</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> expected <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>numTotal<span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> numImplemented<span style="color: #339933;">:</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; expect<span style="color: #009900;">&#40;</span>actual<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toEqual</span><span style="color: #009900;">&#40;</span>expected<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Due to the new requirement I get two failing tests.</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">forMethods (no mocking)<br />
&nbsp; it should return {numTotal:1, numImplemented:1}<br />
&nbsp; Error: Failed at test/summary-spec.js:40:20<br />
&nbsp; Expected<br />
&nbsp; &nbsp; &nbsp; { numTotal : 1, numImplemented : 0 }<br />
&nbsp; to equal<br />
&nbsp; &nbsp; &nbsp; { numTotal : 1, numImplemented : 1 }.<br />
&nbsp; &nbsp; at [object Object].&lt;anonymous&gt; (test/summary-spec.js:40:20)<br />
<br />
forMethods (no mocking)<br />
&nbsp; it should return {numTotal:1, numImplemented:0} for a dummy function<br />
&nbsp; Error: Failed at test/summary-spec.js:52:20<br />
&nbsp; Expected<br />
&nbsp; &nbsp; &nbsp; { numTotal : 1, numImplemented : 1 }<br />
&nbsp; to equal<br />
&nbsp; &nbsp; &nbsp; { numTotal : 1, numImplemented : 0 }.<br />
&nbsp; &nbsp; at [object Object].&lt;anonymous&gt; (test/summary-spec.js:52:20)</div></td></tr></tbody></table></div>
<p>But I don&#8217;t see exactly where my code fails due to this new requirement. The tests tell me <code class="codecolorer text mac-classic"><span class="text">forMethods()</span></code> fails, but there is a chain of four functions below. So let&#8217;s write a test for <code class="codecolorer text mac-classic"><span class="text">getNumberOfImplementedMethods()</span></code> used by <code class="codecolorer text mac-classic"><span class="text">forMethods()</span></code>.</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">describe<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'getNumberOfImplementedMethods'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; it<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'should return 1'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> actual <span style="color: #339933;">=</span> summary.<span style="color: #660066;">getNumberOfImplementedMethods</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; expect<span style="color: #009900;">&#40;</span>actual<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toBe</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; it<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'should return 0'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> actual <span style="color: #339933;">=</span> summary.<span style="color: #660066;">getNumberOfImplementedMethods</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; expect<span style="color: #009900;">&#40;</span>actual<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toBe</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; it<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'should return 0 for dummyFunctions only'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> actual <span style="color: #339933;">=</span> summary.<span style="color: #660066;">getNumberOfImplementedMethods</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>summary.<span style="color: #660066;">dummyFunction</span><span style="color: #339933;">,</span> summary.<span style="color: #660066;">dummyFunction</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; expect<span style="color: #009900;">&#40;</span>actual<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toBe</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>The last one of those tests fails too</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">getNumberOfImplementedMethods<br />
&nbsp; it should return 0 for dummyFunctions only<br />
&nbsp; Error: Failed at test/summary-spec.js:81:20<br />
&nbsp; Expected<br />
&nbsp; &nbsp; &nbsp; 2<br />
&nbsp; to be<br />
&nbsp; &nbsp; &nbsp; 0.<br />
&nbsp; &nbsp; at [object Object].&lt;anonymous&gt; (test/summary-spec.js:81:20)</div></td></tr></tbody></table></div>
<p>Now I actually get more and more failing tests. Ouch, that hurts and I loose the overview quickly. In my mind I am kinda &#8220;yeah I know this one fails, it will fall into place once I am getting there&#8221;. Doesn&#8217;t feel good and if I get interrupted at this point I might come back and be very unhappy about so many failing tests. Anyway, let&#8217;s go one level deeper, and write tests for <code class="codecolorer text mac-classic"><span class="text">isMethodImplemented()</span></code>, more failing tests. Writing tests for the last function and fixing the code accordingly will solve our dilemma here:</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">describe<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'getMethodDetails'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; it<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'should return `isDummy=false`'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> actual <span style="color: #339933;">=</span> summary.<span style="color: #660066;">getMethodDetails</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; expect<span style="color: #009900;">&#40;</span>actual.<span style="color: #660066;">isDummy</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toBe</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; it<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'should return `isDummy=true`'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> actual <span style="color: #339933;">=</span> summary.<span style="color: #660066;">getMethodDetails</span><span style="color: #009900;">&#40;</span>summary.<span style="color: #660066;">dummyFunction</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; expect<span style="color: #009900;">&#40;</span>actual.<span style="color: #660066;">isDummy</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toBe</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Both of the tests fail.</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">getMethodDetails<br />
&nbsp; it should return `isDummy=false`<br />
&nbsp; Error: Failed at test/summary-spec.js:61:28<br />
&nbsp; Expected<br />
&nbsp; &nbsp; &nbsp; true<br />
&nbsp; to be<br />
&nbsp; &nbsp; &nbsp; false.<br />
&nbsp; &nbsp; at [object Object].&lt;anonymous&gt; (test/summary-spec.js:61:28)<br />
<br />
getMethodDetails (no mocking)<br />
&nbsp; it should return `isDummy=true`<br />
&nbsp; Error: Failed at test/summary-spec.js:66:28<br />
&nbsp; Expected<br />
&nbsp; &nbsp; &nbsp; false<br />
&nbsp; to be<br />
&nbsp; &nbsp; &nbsp; true.<br />
&nbsp; &nbsp; at [object Object].&lt;anonymous&gt; (test/summary-spec.js:66:28)<br />
<br />
Finished in 0.014 seconds</div></td></tr></tbody></table></div>
<p>Of course they fail, since I didn&#8217;t fix the actual code that compares the dummyFunction, so I fix the implementation of <code class="codecolorer text mac-classic"><span class="text">getMethodDetails()</span></code> to compare the method to <code class="codecolorer text mac-classic"><span class="text">this.dummyFunction</span></code> and not <code class="codecolorer text mac-classic"><span class="text">function(){}</span></code> anymore</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">getMethodDetails<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>method<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; exists<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">typeof</span> method <span style="color: #339933;">==</span> <span style="color: #3366CC;">'function'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; isDummy<span style="color: #339933;">:</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">+</span>method <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">+</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">dummyFunction</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span></div></td></tr></tbody></table></div>
<p>If I run the tests now all of them are passing. Fine.</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Started<br />
..............<br />
<br />
Finished in 0.005 seconds<br />
14 tests, 14 assertions, 0 failures, 14 passes</div></td></tr></tbody></table></div>
<p>That was a little painful. I had to go all the way down the rabbit hole to find the actual problem. If I imagine this in a bigger architecture I know why I rather start writing tests early, also with the danger of them getting thrown away, because the code becomes obsolete, gets rewritten etc. That&#8217;s fine.</p>
<p>Let&#8217;s try another approach. I write some mock tests and see if that gets me any further quicker.</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">describe<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'forMethods (all mocked)'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; beforeEach<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; spyOn<span style="color: #009900;">&#40;</span>summary<span style="color: #339933;">,</span> <span style="color: #3366CC;">'getNumberOfImplementedMethods'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; it<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'should call `summary.getNumberOfImplementedMethods` properly'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> funcs <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; summary.<span style="color: #660066;">forMethods</span><span style="color: #009900;">&#40;</span>funcs<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; expect<span style="color: #009900;">&#40;</span>summary.<span style="color: #660066;">getNumberOfImplementedMethods</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toHaveBeenCalledWith</span><span style="color: #009900;">&#40;</span>funcs<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; it<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'should have return value of `summary.getNumberOfImplementedMethods` in `numImplemnted`'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; summary.<span style="color: #660066;">getNumberOfImplementedMethods</span>.<span style="color: #660066;">andReturn</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'myValue'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> methodsSummary <span style="color: #339933;">=</span> summary.<span style="color: #660066;">forMethods</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; expect<span style="color: #009900;">&#40;</span>methodsSummary.<span style="color: #660066;">numImplemented</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toBe</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'myValue'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; it<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'should set `numTotal` to 0 for no methods'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> methodsSummary <span style="color: #339933;">=</span> summary.<span style="color: #660066;">forMethods</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; expect<span style="color: #009900;">&#40;</span>methodsSummary.<span style="color: #660066;">numTotal</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toBe</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; it<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'should set `numTotal` to 3 for 3 methods'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// The values don't matter, since we mock all underlying functions</span><br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// that's why we can also pass in integers, we just test the amount here.</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> methodsSummary <span style="color: #339933;">=</span> summary.<span style="color: #660066;">forMethods</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #CC0000;">2</span><span style="color: #339933;">,</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; expect<span style="color: #009900;">&#40;</span>methodsSummary.<span style="color: #660066;">numTotal</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toBe</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Notice, that those tests do also test <code class="codecolorer text mac-classic"><span class="text">forMethods()</span></code> but none of them fails. So it seems I have no problem on that level. Now I can write simple tests for each function. And I will get down to the tests I wrote above for <code class="codecolorer text mac-classic"><span class="text">getMethodDetails()</span></code> and at this point I will discover the actual failure. So mocking leaves me with a way better feeling since I don&#8217;t just add another failing test in the hope of getting to the actual failure at some point.<br />
Let me discuss in the following why I think it makes sense to mix both approaches why I think that there is not only one way to do it. The mix has to be right.</p>
<h2>Not Mocking</h2>
<p>How I started by not mocking anything, was a logical start. I have the user&#8217;s view, and in our case the API user just wants to get the result if a set of methods is implemented. Over time four methods came along, that <code class="codecolorer text mac-classic"><span class="text">forMethods()</span></code> used. At some point when the hierarchy becomes deeper, esp. when functions get reused in multiple parts you start writing tests for the functions on the level below. Those tests are definitely a good thing, since you gain confidence in the underlying parts.<br />
The problem I faced a couple of times was if I change a requirement that is handled by the fourth function down the hierarchy I get failing tests for all four functions. That means you need to know where to look first, either you know your code well or you have sorted the tests to run in a certain order, so that the failing functions lowest in the hierarchy show up first and you can work top down. But even knowing how to put them in the right order requires knowledge of the entire architecture and dependencies. And that will fail when your team grows because not everyone knows how to sort the tests right. And maintaining such an order will become tedious task and is prone to errors.<br />
But non-mocking tests are an important part of testing, they allow me to stay on the same level where the API is used and I don&#8217;t loose the real use cases out of sight, but still they might be misleading.</p>
<h2>Mocking</h2>
<p>I experienced that starting out with mock tests is not the way to go either. I would nail down too many dependencies too soon. Therefore I stay with unmocked tests for the most part in the beginning, but once the architecture shapes I start mocking away stuff and therefore decoupling the different levels. In the above case I can easily find errors on each of the four levels by having mock tests. Yes, a mock test is describing the implementation closer, but if the requirements change the implementation might change too and then it is ok to change the according tests too. The great thing is that I can focus on one level of implementation and I am confident that the levels below are working so by mocking I am just assuring that each of the working pieces is just wired up correctly.<br />
The mock tests do also have the advantage of running much faster since underlying functionality is not invoked that often. Asynchronous behavior can also be avoided nicely this way.<br />
So it&#8217;s still a learning path for me and finding the right balance turns out to be the important thing.</p>
<h2>Conclusion</h2>
<p>I decided to have three sets of tests, which are always grouped into their own <code class="codecolorer text mac-classic"><span class="text">describe()</span></code> each:</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">describe<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'xxx (all mocked)'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #006600; font-style: italic;">// all tests that mock their dependencies</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
describe<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'xxx (no mocking)'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #006600; font-style: italic;">// all tests that may use the entire stack of underlying functions</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
describe<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'xxx'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #006600; font-style: italic;">// mostly the low level functions that can not be mocked anyways</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Now I would need a way to run all the &#8220;mocked&#8221; tests only to see just those failures. If I don&#8217;t touch jasmine I guess I will have to continue identifying the failing mock tests by searching for the suffix.<br />
The unmocked tests will fall into place later too, if that is not the case I have an edge case that I didn&#8217;t write a mock test for yet, so I will need to do that.<br />
One question that still keeps going around in my head is: are those unmocked tests actually integration tests, or as bad as them?</p>
<p>I am looking forward to input. How do you do it? What can I improve? If someone learned something here I am happy. And please share your experiences too, I want to learn too.<br />
Find the <a href="https://github.com/uxebu/mock-or-not-article" title="Source code" target="_blank">source code on github</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2012/04/04/to-mock-or-not-to-mock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Webbrowser ohne Installation testen</title>
		<link>http://uxebu.com/blog/2009/02/24/webbrowser-ohne-installation-testen/</link>
		<comments>http://uxebu.com/blog/2009/02/24/webbrowser-ohne-installation-testen/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 20:30:20 +0000</pubDate>
		<dc:creator>wolfram</dc:creator>
				<category><![CDATA[Tumbles]]></category>
		<category><![CDATA[multiple browsers]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://blog.uxebu.com/?p=120</guid>
		<description><![CDATA[Webbrowser ohne Installation testen]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.heise.de/newsticker/Webbrowser-ohne-Installation-testen--/meldung/133454">Webbrowser ohne Installation testen</a></p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2009/02/24/webbrowser-ohne-installation-testen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

