<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Testing function vs testing implementation</title>
	<atom:link href="http://theshyam.com/2009/09/testing-function-vs-testing-implementation/feed/" rel="self" type="application/rss+xml" />
	<link>http://theshyam.com/2009/09/testing-function-vs-testing-implementation/</link>
	<description>Thoughts and factoids from the Real Shyam. You know, unlike those fake ones!!</description>
	<lastBuildDate>Wed, 21 Apr 2010 17:05:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Zilvinas</title>
		<link>http://theshyam.com/2009/09/testing-function-vs-testing-implementation/comment-page-1/#comment-151</link>
		<dc:creator>Zilvinas</dc:creator>
		<pubDate>Tue, 22 Sep 2009 11:34:57 +0000</pubDate>
		<guid isPermaLink="false">http://theshyam.com/?p=215#comment-151</guid>
		<description>I understand that if you&#039;re testing an algorithm then you only care about the result (which is always there for you). Imagine testing a scheduled task that calls methods that do not return a result at all. For example:

$synchronizer = new Synchronizer($dep1, $dep2, $dep3);
$synchronizer-&gt;run();

Now run does not return anything because noone cares about what it returns and only what it performs.

Now how do you test that this Synchronizer is working correctly? This is one of the reasons that in cases like this i started returning statistic results like array ( &#039;synced_count_of_files&#039; =&gt; 10, &#039;files_processed_count&#039; =&gt; 30) and assert those values in my tests. That way I don&#039;t have to test that depedencies got called X many times, and were passed values Y. So if the implementation changes the result stays the same.

Is this what you would do? If not how would you do it differently?
Thanks!</description>
		<content:encoded><![CDATA[<p>I understand that if you&#8217;re testing an algorithm then you only care about the result (which is always there for you). Imagine testing a scheduled task that calls methods that do not return a result at all. For example:</p>
<p>$synchronizer = new Synchronizer($dep1, $dep2, $dep3);<br />
$synchronizer-&gt;run();</p>
<p>Now run does not return anything because noone cares about what it returns and only what it performs.</p>
<p>Now how do you test that this Synchronizer is working correctly? This is one of the reasons that in cases like this i started returning statistic results like array ( &#8217;synced_count_of_files&#8217; =&gt; 10, &#8216;files_processed_count&#8217; =&gt; 30) and assert those values in my tests. That way I don&#8217;t have to test that depedencies got called X many times, and were passed values Y. So if the implementation changes the result stays the same.</p>
<p>Is this what you would do? If not how would you do it differently?<br />
Thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
