<?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: Test-drive properly, test fully</title>
	<atom:link href="http://jagregory.com/writings/test-drive-properly-test-fully/feed/" rel="self" type="application/rss+xml" />
	<link>http://jagregory.com/writings/test-drive-properly-test-fully/</link>
	<description>Monkeying with the code</description>
	<lastBuildDate>Tue, 29 Jun 2010 13:30:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Brychan</title>
		<link>http://jagregory.com/writings/test-drive-properly-test-fully/comment-page-1/#comment-51066</link>
		<dc:creator>Brychan</dc:creator>
		<pubDate>Wed, 24 Feb 2010 08:32:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/2007/07/21/test-drive-properly-test-fully/#comment-51066</guid>
		<description>I am happy I found your site on bing. Thank you for the sensible critique. Me and my brother were just preparing to do some research about this. I am very happy to see such trusted info being shared for free out there.
Regards,
Amadeus from Eugene city</description>
		<content:encoded><![CDATA[<p>I am happy I found your site on bing. Thank you for the sensible critique. Me and my brother were just preparing to do some research about this. I am very happy to see such trusted info being shared for free out there.<br />
Regards,<br />
Amadeus from Eugene city</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ricky Clarkson</title>
		<link>http://jagregory.com/writings/test-drive-properly-test-fully/comment-page-1/#comment-132</link>
		<dc:creator>Ricky Clarkson</dc:creator>
		<pubDate>Sun, 22 Jul 2007 03:45:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/2007/07/21/test-drive-properly-test-fully/#comment-132</guid>
		<description>Testing can only prove that your code works for the cases that you test.  Exhaustive testing is impractical for many functions.

Maybe you should look at a real system for constructing proofs, such as Haskell, or Epigram.  My experience with Haskell is that the effort required to construct the proof is greater than the need for the proof.  All I really need is some confidence in the code, usually.  There may be cases where I need real proof, and that is when a type checker may be useful.

I&#039;m not saying that automated tests are useless, merely that applying a rule that states that they should always be done before writing the code that they test, is likely to be harmful.  Also, that the intermediate stage, where you write naive code to make a single test pass, is also harmful.</description>
		<content:encoded><![CDATA[<p>Testing can only prove that your code works for the cases that you test.  Exhaustive testing is impractical for many functions.</p>
<p>Maybe you should look at a real system for constructing proofs, such as Haskell, or Epigram.  My experience with Haskell is that the effort required to construct the proof is greater than the need for the proof.  All I really need is some confidence in the code, usually.  There may be cases where I need real proof, and that is when a type checker may be useful.</p>
<p>I&#8217;m not saying that automated tests are useless, merely that applying a rule that states that they should always be done before writing the code that they test, is likely to be harmful.  Also, that the intermediate stage, where you write naive code to make a single test pass, is also harmful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Gregory</title>
		<link>http://jagregory.com/writings/test-drive-properly-test-fully/comment-page-1/#comment-123</link>
		<dc:creator>James Gregory</dc:creator>
		<pubDate>Sat, 21 Jul 2007 16:25:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/2007/07/21/test-drive-properly-test-fully/#comment-123</guid>
		<description>Well, I think proof is part of confidence. I&#039;m not a big believer, faith doesn&#039;t come into programming for me. If I write a method, I want proof that it works how it&#039;s supposed to. Maybe when it was written it was obvious how things would work, but leave it a year and have several other programmers work on it, and how sure are you now?

Using your example, it&#039;s obviously very simple and doesn&#039;t require a wealth of tests, but I still think you need to at least test if it works under valid and invalid conditions. Yes, we both know how it works now, but what happens when somebody replaces { return x; } with { if (x == null) return new NullObject() else return x; }.

These examples are a bit contrived though, testing something as tiny and abstract probably wont fall into the usual realm of testing. As long as these methods are covered in your other more substantial tests then I probably wouldn&#039;t worry about them.</description>
		<content:encoded><![CDATA[<p>Well, I think proof is part of confidence. I&#8217;m not a big believer, faith doesn&#8217;t come into programming for me. If I write a method, I want proof that it works how it&#8217;s supposed to. Maybe when it was written it was obvious how things would work, but leave it a year and have several other programmers work on it, and how sure are you now?</p>
<p>Using your example, it&#8217;s obviously very simple and doesn&#8217;t require a wealth of tests, but I still think you need to at least test if it works under valid and invalid conditions. Yes, we both know how it works now, but what happens when somebody replaces { return x; } with { if (x == null) return new NullObject() else return x; }.</p>
<p>These examples are a bit contrived though, testing something as tiny and abstract probably wont fall into the usual realm of testing. As long as these methods are covered in your other more substantial tests then I probably wouldn&#8217;t worry about them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ricky Clarkson</title>
		<link>http://jagregory.com/writings/test-drive-properly-test-fully/comment-page-1/#comment-122</link>
		<dc:creator>Ricky Clarkson</dc:creator>
		<pubDate>Sat, 21 Jul 2007 15:32:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/2007/07/21/test-drive-properly-test-fully/#comment-122</guid>
		<description>So what you&#039;re saying is that if you have only one case being tested, then it&#039;s ok to hard-code the answer into the test case, but if you have 10 cases, then it&#039;s not ok and you should then write the method properly.

I disagree - you should write the method properly in the first place.  If you don&#039;t, then even the first test case is useless.

In terms of coverage, if that refers to whether lines are executed or not, consider the identity function:

(lambda (x) x) (or, in Java, Object id(Object x){return x;}).

If I write my test for that to only test for 5, it makes zero sense to write the identity function as (lambda (x) 5) (or, return 5;).

The identity function is so simple that it really doesn&#039;t need (runtime) tests anyway, of course, but what is plain is that you get complete code coverage of it from one test.  Writing ten tests for it doesn&#039;t improve matters.  As soon as your test code is bigger (conceptually, not necessarily in lines of code) than the code it&#039;s testing, you&#039;re probably trying to prove through testing, which is usually impossible.

I&#039;d suggest you use testing to give yourself confidence, not to prove things.  Proofs can be constructed with other tools, such as type systems (or with your brain).</description>
		<content:encoded><![CDATA[<p>So what you&#8217;re saying is that if you have only one case being tested, then it&#8217;s ok to hard-code the answer into the test case, but if you have 10 cases, then it&#8217;s not ok and you should then write the method properly.</p>
<p>I disagree &#8211; you should write the method properly in the first place.  If you don&#8217;t, then even the first test case is useless.</p>
<p>In terms of coverage, if that refers to whether lines are executed or not, consider the identity function:</p>
<p>(lambda (x) x) (or, in Java, Object id(Object x){return x;}).</p>
<p>If I write my test for that to only test for 5, it makes zero sense to write the identity function as (lambda (x) 5) (or, return 5;).</p>
<p>The identity function is so simple that it really doesn&#8217;t need (runtime) tests anyway, of course, but what is plain is that you get complete code coverage of it from one test.  Writing ten tests for it doesn&#8217;t improve matters.  As soon as your test code is bigger (conceptually, not necessarily in lines of code) than the code it&#8217;s testing, you&#8217;re probably trying to prove through testing, which is usually impossible.</p>
<p>I&#8217;d suggest you use testing to give yourself confidence, not to prove things.  Proofs can be constructed with other tools, such as type systems (or with your brain).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
