<?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"
	>
<channel>
	<title>Comments on: A Program Is Born: QCMake&#8217;s First Functional Test</title>
	<atom:link href="http://klimek.box4.net/blog/2007/11/02/a-program-is-born-qcmakes-first-functional-test/feed/" rel="self" type="application/rss+xml" />
	<link>http://klimek.box4.net/blog/2007/11/02/a-program-is-born-qcmakes-first-functional-test/</link>
	<description>Dedicated to Software Development</description>
	<pubDate>Fri, 21 Nov 2008 10:46:21 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Adrian Smith</title>
		<link>http://klimek.box4.net/blog/2007/11/02/a-program-is-born-qcmakes-first-functional-test/#comment-10887</link>
		<dc:creator>Adrian Smith</dc:creator>
		<pubDate>Fri, 02 Nov 2007 09:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://klimek.box4.net/blog/2007/11/02/a-program-is-born-qcmakes-first-functional-test/#comment-10887</guid>
		<description>Yeah I usually find some test utilities are required to write test scripts. Recursively removing a directory would seem to be one of them, as it's possible/plausible/likely you'll need this from multiple tests. Or even from the main program. Or another main program you'll write some day.

I work a lot with website software which provide most of their functionality when the user is logged in. So I always create dummy users to perform tests on. This often takes a few lines (e.g. handling things like unique constraints on email addresses, etc.). This is certainly code shared between multiple tests. Sometimes I need to create products and baskets to attempt various algorithms. This is also code not specific to a single test (even if it happens only to be used by one test at the time I need it first). So I tend to extend e.g. the "User" class with a static function like "CreateForTesting". The "ForTesting" is a hint that it's not intended to be called from the main program.

This means that all test scripts have access to this functionality rather than having it duplicated amongst multiple tests. And for me it just seems to be a function of a User, that the User software is able to create a dummy version of a User. So it's appropriate to put it there. And if you need to change the user, you'll consider updating that function. It's certainly extremely convenient to program that way. A bunch of classes can create useful test instances of themselves.

This goes against some "best practice" wisdom, that test code should be separate from live code. But as far as I'm concerned code locality is good, and a class has multiple clients anyway, and a test script is just another one of them.</description>
		<content:encoded><![CDATA[<p>Yeah I usually find some test utilities are required to write test scripts. Recursively removing a directory would seem to be one of them, as it&#8217;s possible/plausible/likely you&#8217;ll need this from multiple tests. Or even from the main program. Or another main program you&#8217;ll write some day.</p>
<p>I work a lot with website software which provide most of their functionality when the user is logged in. So I always create dummy users to perform tests on. This often takes a few lines (e.g. handling things like unique constraints on email addresses, etc.). This is certainly code shared between multiple tests. Sometimes I need to create products and baskets to attempt various algorithms. This is also code not specific to a single test (even if it happens only to be used by one test at the time I need it first). So I tend to extend e.g. the &#8220;User&#8221; class with a static function like &#8220;CreateForTesting&#8221;. The &#8220;ForTesting&#8221; is a hint that it&#8217;s not intended to be called from the main program.</p>
<p>This means that all test scripts have access to this functionality rather than having it duplicated amongst multiple tests. And for me it just seems to be a function of a User, that the User software is able to create a dummy version of a User. So it&#8217;s appropriate to put it there. And if you need to change the user, you&#8217;ll consider updating that function. It&#8217;s certainly extremely convenient to program that way. A bunch of classes can create useful test instances of themselves.</p>
<p>This goes against some &#8220;best practice&#8221; wisdom, that test code should be separate from live code. But as far as I&#8217;m concerned code locality is good, and a class has multiple clients anyway, and a test script is just another one of them.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
