<?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: How to Write Good Unit Tests</title>
	<atom:link href="http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests</link>
	<description></description>
	<lastBuildDate>Wed, 08 Feb 2012 03:57:22 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Basil Vandegriend</title>
		<link>http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests/comment-page-1#comment-133114</link>
		<dc:creator>Basil Vandegriend</dc:creator>
		<pubDate>Mon, 27 Jun 2011 03:43:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests#comment-133114</guid>
		<description>@Shashhank, there are many options for testing database interactions. If you need to do lots of data setup, I suggest checking out DBUnit. My preferred approach, assuming you are using Spring for transaction management, is to use Spring&#039;s test framework so that each test involving the database executes as a single transaction that is rolled back, thus minimizing the problems from having tests change data in the database.</description>
		<content:encoded><![CDATA[<p>@Shashhank, there are many options for testing database interactions. If you need to do lots of data setup, I suggest checking out DBUnit. My preferred approach, assuming you are using Spring for transaction management, is to use Spring&#8217;s test framework so that each test involving the database executes as a single transaction that is rolled back, thus minimizing the problems from having tests change data in the database.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shashank</title>
		<link>http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests/comment-page-1#comment-133063</link>
		<dc:creator>Shashank</dc:creator>
		<pubDate>Sun, 26 Jun 2011 08:09:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests#comment-133063</guid>
		<description>Basil, I am looking for guidance on writing a test suite for set of java files doing either persistance of xml to DB or doing manipulation, validation of Data in DB. any references doing the same would be of great help.

Thanks.</description>
		<content:encoded><![CDATA[<p>Basil, I am looking for guidance on writing a test suite for set of java files doing either persistance of xml to DB or doing manipulation, validation of Data in DB. any references doing the same would be of great help.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aleksei</title>
		<link>http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests/comment-page-1#comment-118752</link>
		<dc:creator>Aleksei</dc:creator>
		<pubDate>Wed, 05 Jan 2011 18:49:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests#comment-118752</guid>
		<description>In fact, quite unuseful article... Most of thing are too obvious but the principles of designing test cases are not covered.</description>
		<content:encoded><![CDATA[<p>In fact, quite unuseful article&#8230; Most of thing are too obvious but the principles of designing test cases are not covered.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Testing / Unit Testing – Session 1 &#171; Allan Waddell&#8217;s Weblog</title>
		<link>http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests/comment-page-1#comment-113053</link>
		<dc:creator>Testing / Unit Testing – Session 1 &#171; Allan Waddell&#8217;s Weblog</dc:creator>
		<pubDate>Sat, 09 Oct 2010 02:46:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests#comment-113053</guid>
		<description>[...] How to write good unit tests: http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests [...]</description>
		<content:encoded><![CDATA[<p>[...] How to write good unit tests: <a href="http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests" rel="nofollow">http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Why is automated unit testing important? &#171; Ryan Eastabrook</title>
		<link>http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests/comment-page-1#comment-104354</link>
		<dc:creator>Why is automated unit testing important? &#171; Ryan Eastabrook</dc:creator>
		<pubDate>Wed, 17 Feb 2010 04:21:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests#comment-104354</guid>
		<description>[...] (Java): http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests      Categories: Uncategorized        Comments (0) Trackbacks (0) Leave a comment [...]</description>
		<content:encoded><![CDATA[<p>[...] (Java): <a href="http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests" rel="nofollow">http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests</a>      Categories: Uncategorized        Comments (0) Trackbacks (0) Leave a comment [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Basil Vandegriend</title>
		<link>http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests/comment-page-1#comment-97714</link>
		<dc:creator>Basil Vandegriend</dc:creator>
		<pubDate>Sat, 26 Sep 2009 02:36:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests#comment-97714</guid>
		<description>@tinca, I often do write tests for a method based on its contract (preconditions &amp; postconditions). However, I seldom test for the negative case (e.g. that the method fails with an exception if a precondition is violated). Instead, I focus on testing that the method behaves properly when the preconditions are met. E.g. if an argument can be null, then I verify that the method accepts a null as well as a non-null value.</description>
		<content:encoded><![CDATA[<p>@tinca, I often do write tests for a method based on its contract (preconditions &#038; postconditions). However, I seldom test for the negative case (e.g. that the method fails with an exception if a precondition is violated). Instead, I focus on testing that the method behaves properly when the preconditions are met. E.g. if an argument can be null, then I verify that the method accepts a null as well as a non-null value.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tinca</title>
		<link>http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests/comment-page-1#comment-97683</link>
		<dc:creator>tinca</dc:creator>
		<pubDate>Fri, 25 Sep 2009 05:41:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests#comment-97683</guid>
		<description>Would you write cases that test contracts? For instance: when null is passed IllegalArgumentException must be thrown? It may seem a trivial one, but on the long run it can protect again accidental changes.</description>
		<content:encoded><![CDATA[<p>Would you write cases that test contracts? For instance: when null is passed IllegalArgumentException must be thrown? It may seem a trivial one, but on the long run it can protect again accidental changes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Basil Vandegriend</title>
		<link>http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests/comment-page-1#comment-79305</link>
		<dc:creator>Basil Vandegriend</dc:creator>
		<pubDate>Sat, 07 Feb 2009 14:00:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests#comment-79305</guid>
		<description>@Rick, there are a few guidelines I can provide about when the code is not trivial. The two solid examples I provided in the article where getter &amp; setter methods with no logic and simple constructors (that just populate fields from parameters passed in). Another example would be delegate methods that simnply delegate execution to another class. I.e.
private Bar delegate;

public void doStuff(Foo foo) {
  delegate.doStuff(foo);
}

The general principle is this: how confident are you that the code is correct? If you are 100% confident, then this is trivial code that you do not need to test. If you have doubts or uncertainties, then you should write a test.</description>
		<content:encoded><![CDATA[<p>@Rick, there are a few guidelines I can provide about when the code is not trivial. The two solid examples I provided in the article where getter &#038; setter methods with no logic and simple constructors (that just populate fields from parameters passed in). Another example would be delegate methods that simnply delegate execution to another class. I.e.<br />
private Bar delegate;</p>
<p>public void doStuff(Foo foo) {<br />
  delegate.doStuff(foo);<br />
}</p>
<p>The general principle is this: how confident are you that the code is correct? If you are 100% confident, then this is trivial code that you do not need to test. If you have doubts or uncertainties, then you should write a test.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Pingry</title>
		<link>http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests/comment-page-1#comment-79107</link>
		<dc:creator>Rick Pingry</dc:creator>
		<pubDate>Fri, 06 Feb 2009 23:58:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests#comment-79107</guid>
		<description>I would like to know more about writing tests for trivial code.  When is the code NOT trivial?  Where is the line between trivial code and non-trivial code?  Can anyone provide some solid examples?</description>
		<content:encoded><![CDATA[<p>I would like to know more about writing tests for trivial code.  When is the code NOT trivial?  Where is the line between trivial code and non-trivial code?  Can anyone provide some solid examples?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Basil Vandegriend</title>
		<link>http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests/comment-page-1#comment-71972</link>
		<dc:creator>Basil Vandegriend</dc:creator>
		<pubDate>Wed, 07 Jan 2009 01:46:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.basilv.com/psd/blog/2006/how-to-write-good-unit-tests#comment-71972</guid>
		<description>@Deepak, thanks for your comment. The article does provide guidance on how to transform the &#039;what-not-to-do&#039; examples into better tests. I explicitly wrote the article this way to provide some concrete guidance to people to write better tests, but you are right that I do not provide instructions on the basics of writing a good test case. I am tentatively planning to write some more articles on unit testing in the near future, so stay tuned.</description>
		<content:encoded><![CDATA[<p>@Deepak, thanks for your comment. The article does provide guidance on how to transform the &#8216;what-not-to-do&#8217; examples into better tests. I explicitly wrote the article this way to provide some concrete guidance to people to write better tests, but you are right that I do not provide instructions on the basics of writing a good test case. I am tentatively planning to write some more articles on unit testing in the near future, so stay tuned.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

