<?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 Best Practices</title>
	<atom:link href="http://gokubi.com/archives/testing-best-practices/feed" rel="self" type="application/rss+xml" />
	<link>http://gokubi.com/archives/testing-best-practices</link>
	<description></description>
	<lastBuildDate>Thu, 04 Mar 2010 13:37:32 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Steve</title>
		<link>http://gokubi.com/archives/testing-best-practices/comment-page-1#comment-148649</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 15 Dec 2008 04:33:24 +0000</pubDate>
		<guid isPermaLink="false">http://gokubi.com/?p=765#comment-148649</guid>
		<description>That&#039;s an interesting concept. Thanks for the pointer to it!</description>
		<content:encoded><![CDATA[<p>That&#8217;s an interesting concept. Thanks for the pointer to it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reid</title>
		<link>http://gokubi.com/archives/testing-best-practices/comment-page-1#comment-148644</link>
		<dc:creator>Reid</dc:creator>
		<pubDate>Mon, 15 Dec 2008 03:26:37 +0000</pubDate>
		<guid isPermaLink="false">http://gokubi.com/?p=765#comment-148644</guid>
		<description>+1 on everything, glad to see it all here.  One thing I would add regarding the question of what to test.  Most developers test business logic that should lead a class or method to function successfully.  I always like to see people test things that they think should fail.  A missing parameter here or some bad data there, for example.

FWIW, in addition to TDD, there&#039;s a cool thing out there called &lt;a href=&quot;http://en.wikipedia.org/wiki/Design_by_contract&quot; rel=&quot;nofollow&quot;&gt;Design by Contract&lt;/a&gt; or Programming by Contract.  It&#039;s not appropriate for every programming challenge, but it&#039;s a useful frame of reference to have in your bag of tricks.

Cheers!</description>
		<content:encoded><![CDATA[<p>+1 on everything, glad to see it all here.  One thing I would add regarding the question of what to test.  Most developers test business logic that should lead a class or method to function successfully.  I always like to see people test things that they think should fail.  A missing parameter here or some bad data there, for example.</p>
<p>FWIW, in addition to TDD, there&#8217;s a cool thing out there called <a href="http://en.wikipedia.org/wiki/Design_by_contract" rel="nofollow">Design by Contract</a> or Programming by Contract.  It&#8217;s not appropriate for every programming challenge, but it&#8217;s a useful frame of reference to have in your bag of tricks.</p>
<p>Cheers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://gokubi.com/archives/testing-best-practices/comment-page-1#comment-147605</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Wed, 10 Dec 2008 01:03:44 +0000</pubDate>
		<guid isPermaLink="false">http://gokubi.com/?p=765#comment-147605</guid>
		<description>Shhh David, some of our clients may read this blog...

All my testing to date has been unit testing. One of the great things about VisualForce is that if I use standard components, all that integration testing should already have been done by Courtney&#039;s team down at Salesforce!</description>
		<content:encoded><![CDATA[<p>Shhh David, some of our clients may read this blog&#8230;</p>
<p>All my testing to date has been unit testing. One of the great things about VisualForce is that if I use standard components, all that integration testing should already have been done by Courtney&#8217;s team down at Salesforce!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://gokubi.com/archives/testing-best-practices/comment-page-1#comment-147604</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Wed, 10 Dec 2008 01:01:14 +0000</pubDate>
		<guid isPermaLink="false">http://gokubi.com/?p=765#comment-147604</guid>
		<description>Thanks Jesse. I had to miss that session because I was speaking in another. I forgot about it, so thanks for the link.</description>
		<content:encoded><![CDATA[<p>Thanks Jesse. I had to miss that session because I was speaking in another. I forgot about it, so thanks for the link.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Glick</title>
		<link>http://gokubi.com/archives/testing-best-practices/comment-page-1#comment-147601</link>
		<dc:creator>David Glick</dc:creator>
		<pubDate>Wed, 10 Dec 2008 00:57:45 +0000</pubDate>
		<guid isPermaLink="false">http://gokubi.com/?p=765#comment-147601</guid>
		<description>Great stuff, Steve.

On the Plone side, one point that I&#039;ve found helpful is the distinction between unit tests and integration tests.  Unit tests focus on a particular function and make sure that it behave properly for a range of different inputs.  Integration tests test the system as a whole and make sure that everything is wired together properly.  For the latter, we use the zope.testbrowser package which lets us write Python code that mimics a web browser and can click links, press buttons, etc.  (no real rendering or Javascript support though -- for that you need something like selenium)

This post also raises the question -- does ONE/Northwest have any developers who have taken a real CS course?  I only lasted a day in the one I tried... :)</description>
		<content:encoded><![CDATA[<p>Great stuff, Steve.</p>
<p>On the Plone side, one point that I&#8217;ve found helpful is the distinction between unit tests and integration tests.  Unit tests focus on a particular function and make sure that it behave properly for a range of different inputs.  Integration tests test the system as a whole and make sure that everything is wired together properly.  For the latter, we use the zope.testbrowser package which lets us write Python code that mimics a web browser and can click links, press buttons, etc.  (no real rendering or Javascript support though &#8212; for that you need something like selenium)</p>
<p>This post also raises the question &#8212; does ONE/Northwest have any developers who have taken a real CS course?  I only lasted a day in the one I tried&#8230; <img src='http://gokubi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesse Lorenz</title>
		<link>http://gokubi.com/archives/testing-best-practices/comment-page-1#comment-147599</link>
		<dc:creator>Jesse Lorenz</dc:creator>
		<pubDate>Wed, 10 Dec 2008 00:50:54 +0000</pubDate>
		<guid isPermaLink="false">http://gokubi.com/?p=765#comment-147599</guid>
		<description>I&#039;m with Mike - TDD is great. Test Driven Development makes developers think about how clients will use their code straight away. As a result, they&#039;re able to write code faster and have to refactor less often.

The &quot;Apex Test Coverage Best Practices&quot; session from Dreamforce is a great resource for developers intrested in Unit Testing in general: http://www.salesforce.com/community/crm-best-practices/dreamforce08-developer-sessions/2008-tdf-mastering-apex-best-practices.jsp</description>
		<content:encoded><![CDATA[<p>I&#8217;m with Mike &#8211; TDD is great. Test Driven Development makes developers think about how clients will use their code straight away. As a result, they&#8217;re able to write code faster and have to refactor less often.</p>
<p>The &#8220;Apex Test Coverage Best Practices&#8221; session from Dreamforce is a great resource for developers intrested in Unit Testing in general: <a href="http://www.salesforce.com/community/crm-best-practices/dreamforce08-developer-sessions/2008-tdf-mastering-apex-best-practices.jsp" rel="nofollow">http://www.salesforce.com/community/crm-best-practices/dreamforce08-developer-sessions/2008-tdf-mastering-apex-best-practices.jsp</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://gokubi.com/archives/testing-best-practices/comment-page-1#comment-147580</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 09 Dec 2008 23:01:43 +0000</pubDate>
		<guid isPermaLink="false">http://gokubi.com/?p=765#comment-147580</guid>
		<description>Thanks Mike!

These are great tips. I love them all and will be incorporating them in my daily coding practice (sounds like yoga when I say it that way...)</description>
		<content:encoded><![CDATA[<p>Thanks Mike!</p>
<p>These are great tips. I love them all and will be incorporating them in my daily coding practice (sounds like yoga when I say it that way&#8230;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://gokubi.com/archives/testing-best-practices/comment-page-1#comment-147574</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Tue, 09 Dec 2008 22:46:22 +0000</pubDate>
		<guid isPermaLink="false">http://gokubi.com/?p=765#comment-147574</guid>
		<description>I&#039;d say you&#039;re in the top 20 percentile of all Software Developers if you&#039;re consistently implementing these practices.

Like most software dev projects, long term success is defined by low cost-of-change over time (aka &#039;Agility&#039;).

Some things I&#039;m conscious of when coding with unit tests:
* Test-Driven-Development: Write a unit test first that most elegantly documents the desired object interfaces and control flow, then write actual classes to make the test pass. This qualifies as formal &#039;design&#039; in agile projects.
* 500 line rule. Time to refactor if any file/class gets over 500 lines.
* 5 minute refactoring rule. Approach larger problems as a series of smaller 5 minute refactoring drills; each with corresponding unit test changes (I dread refactoring lots of code then having to go back and clean-up tests).
* Self-Documenting: Write tests as a means to describing and documenting the intended usage of the system. A self-explanatory method or test name is preferred over comments.</description>
		<content:encoded><![CDATA[<p>I&#8217;d say you&#8217;re in the top 20 percentile of all Software Developers if you&#8217;re consistently implementing these practices.</p>
<p>Like most software dev projects, long term success is defined by low cost-of-change over time (aka &#8216;Agility&#8217;).</p>
<p>Some things I&#8217;m conscious of when coding with unit tests:<br />
* Test-Driven-Development: Write a unit test first that most elegantly documents the desired object interfaces and control flow, then write actual classes to make the test pass. This qualifies as formal &#8216;design&#8217; in agile projects.<br />
* 500 line rule. Time to refactor if any file/class gets over 500 lines.<br />
* 5 minute refactoring rule. Approach larger problems as a series of smaller 5 minute refactoring drills; each with corresponding unit test changes (I dread refactoring lots of code then having to go back and clean-up tests).<br />
* Self-Documenting: Write tests as a means to describing and documenting the intended usage of the system. A self-explanatory method or test name is preferred over comments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://gokubi.com/archives/testing-best-practices/comment-page-1#comment-147573</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 09 Dec 2008 22:42:11 +0000</pubDate>
		<guid isPermaLink="false">http://gokubi.com/?p=765#comment-147573</guid>
		<description>Yes, that&#039;s the way I do it. Sorry it wasn&#039;t clear. If you create an Account in your test data, make sure it has a funky name if you ever are querying it by name. That was the point I was trying to make. 90+% of the time we&#039;re getting records by Id, but in a couple cases I&#039;ve needed to query by name.

@IsTest is the same as testMethod, but it appears it does except that code from the total 1 MB limit for all Apex code. Glad I&#039;m not anywhere near that big!</description>
		<content:encoded><![CDATA[<p>Yes, that&#8217;s the way I do it. Sorry it wasn&#8217;t clear. If you create an Account in your test data, make sure it has a funky name if you ever are querying it by name. That was the point I was trying to make. 90+% of the time we&#8217;re getting records by Id, but in a couple cases I&#8217;ve needed to query by name.</p>
<p>@IsTest is the same as testMethod, but it appears it does except that code from the total 1 MB limit for all Apex code. Glad I&#8217;m not anywhere near that big!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Hemmeter</title>
		<link>http://gokubi.com/archives/testing-best-practices/comment-page-1#comment-147569</link>
		<dc:creator>Scott Hemmeter</dc:creator>
		<pubDate>Tue, 09 Dec 2008 22:34:28 +0000</pubDate>
		<guid isPermaLink="false">http://gokubi.com/?p=765#comment-147569</guid>
		<description>Regarding test data, I&#039;d recommend actually creating the data as part of your Test Class.  Salesforce creates it for the purposes of the test only and it never goes in the org.  This takes more work, but makes it fully portable.  This might be what you meant in your post, but I wasn&#039;t totally sure.

Use the @IsTest keyword.  I think this means you need to put your Tests in separate classes, though.  Adding this keyword makes it so the test code doesn&#039;t count against your code limit.  This may not matter if you are not coding heavy amounts.</description>
		<content:encoded><![CDATA[<p>Regarding test data, I&#8217;d recommend actually creating the data as part of your Test Class.  Salesforce creates it for the purposes of the test only and it never goes in the org.  This takes more work, but makes it fully portable.  This might be what you meant in your post, but I wasn&#8217;t totally sure.</p>
<p>Use the @IsTest keyword.  I think this means you need to put your Tests in separate classes, though.  Adding this keyword makes it so the test code doesn&#8217;t count against your code limit.  This may not matter if you are not coding heavy amounts.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
