<?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: Unit testing the data access layer</title>
	<atom:link href="http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html</link>
	<description>Thoughts on software development and project management</description>
	<pubDate>Thu, 20 Nov 2008 23:16:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Unit test your layered architecture &#124; Solution Hacker</title>
		<link>http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html#comment-29416</link>
		<dc:creator>Unit test your layered architecture &#124; Solution Hacker</dc:creator>
		<pubDate>Mon, 18 Feb 2008 11:55:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html#comment-29416</guid>
		<description>[...] http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html" rel="nofollow">http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: papo</title>
		<link>http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html#comment-14652</link>
		<dc:creator>papo</dc:creator>
		<pubDate>Wed, 24 Oct 2007 11:57:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html#comment-14652</guid>
		<description>just a link to a book (maybe the one your were thinking of in the post incipit..) :

Test Driven: TDD and Acceptance TDD for Java Developers, by Lasse Koskela
http://www.amazon.com/Test-Driven-Acceptance-Java-Developers/dp/1932394850

it`s chapter on testing a DAL follow the same ideas you pointed out. it`s for Java, but still useful for any other platform (I`m a .NET guy)

bye
-papo-</description>
		<content:encoded><![CDATA[<p>just a link to a book (maybe the one your were thinking of in the post incipit..) :</p>
<p>Test Driven: TDD and Acceptance TDD for Java Developers, by Lasse Koskela<br />
<a href="http://www.amazon.com/Test-Driven-Acceptance-Java-Developers/dp/1932394850" rel="nofollow">http://www.amazon.com/Test-Driven-Acceptance-Java-Developers/dp/1932394850</a></p>
<p>it`s chapter on testing a DAL follow the same ideas you pointed out. it`s for Java, but still useful for any other platform (I`m a .NET guy)</p>
<p>bye<br />
-papo-</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Buu Nguyen</title>
		<link>http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html#comment-12445</link>
		<dc:creator>Buu Nguyen</dc:creator>
		<pubDate>Tue, 02 Oct 2007 04:25:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html#comment-12445</guid>
		<description>@Robert: thanks for noticing, it's indeed another good use of DbUnit.

@Rob: I agree, hitting the database, either in-memory or production is much better than the mock technique.  Also, I have accessed to the links but seem not to understand the approach very well.  It would be great if you can provide some more information (or links).  Thanks!

@James: good approach on the Oracle XE.  If Hibernate is used for the DAL, then leveraging it as a data populator is an good and efficient approach.  Otherwise, DbUnit is good to use.</description>
		<content:encoded><![CDATA[<p>@Robert: thanks for noticing, it&#8217;s indeed another good use of DbUnit.</p>
<p>@Rob: I agree, hitting the database, either in-memory or production is much better than the mock technique.  Also, I have accessed to the links but seem not to understand the approach very well.  It would be great if you can provide some more information (or links).  Thanks!</p>
<p>@James: good approach on the Oracle XE.  If Hibernate is used for the DAL, then leveraging it as a data populator is an good and efficient approach.  Otherwise, DbUnit is good to use.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html#comment-12415</link>
		<dc:creator>James</dc:creator>
		<pubDate>Mon, 01 Oct 2007 18:49:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html#comment-12415</guid>
		<description>I largely agree. I mainly work in an oracle shop. When I test DAO classes, I use a local database. Each dev uses Oracle XE (which doesn't require any more than 10 minutes to install), and every project maintains an ant sql task to build/drop the database schemas. Script and schema is managed by a DM tool like ER studio. I would rather use the REAL database vendor since any non trivial application will find itself using proprietary sql at some point. Hence moving from in memory to another would be too much trouble, since oracle sql can be non standard.

For test setup, on a jpa/hibernate project, I find using hibernate itself as a row populator is a nice way to make sure mappings work, besides its incredible payback for taking time to map properly.

I also use the spring mock test cases, since they make it easy to start a transaction, and rollback at end of test, in addition to caching the jpa configuration, which saves a lot of time.</description>
		<content:encoded><![CDATA[<p>I largely agree. I mainly work in an oracle shop. When I test DAO classes, I use a local database. Each dev uses Oracle XE (which doesn&#8217;t require any more than 10 minutes to install), and every project maintains an ant sql task to build/drop the database schemas. Script and schema is managed by a DM tool like ER studio. I would rather use the REAL database vendor since any non trivial application will find itself using proprietary sql at some point. Hence moving from in memory to another would be too much trouble, since oracle sql can be non standard.</p>
<p>For test setup, on a jpa/hibernate project, I find using hibernate itself as a row populator is a nice way to make sure mappings work, besides its incredible payback for taking time to map properly.</p>
<p>I also use the spring mock test cases, since they make it easy to start a transaction, and rollback at end of test, in addition to caching the jpa configuration, which saves a lot of time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Di Marco</title>
		<link>http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html#comment-12401</link>
		<dc:creator>Rob Di Marco</dc:creator>
		<pubDate>Mon, 01 Oct 2007 12:13:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html#comment-12401</guid>
		<description>Good article.  My thoughts:

-- I greatly prefer using an in-memory database to the mock database.  Using the mock database can be a real pain to debug and maintain.  With the in-memory database option, it is much easier to replicate both the DDL and the data used by your application.  With the mock data set, you sometimes "think" you have it set up the same as your database, but subtle bugs may make that not so.

-- If you are using the Java Persistence API / EJB 3, there are some really cool things that you can do using embedded containers to help simulate the whole transaction.  It makes for very easy setup, configuration and execution.  Having used these techniques, I could never imagine developing a J2EE app without an embedded container unit test.  The presentations are available at http://www.innovationontherun.com/presentations/ and I would be happy to go into more detail if anyone is interested.</description>
		<content:encoded><![CDATA[<p>Good article.  My thoughts:</p>
<p>&#8211; I greatly prefer using an in-memory database to the mock database.  Using the mock database can be a real pain to debug and maintain.  With the in-memory database option, it is much easier to replicate both the DDL and the data used by your application.  With the mock data set, you sometimes &#8220;think&#8221; you have it set up the same as your database, but subtle bugs may make that not so.</p>
<p>&#8211; If you are using the Java Persistence API / EJB 3, there are some really cool things that you can do using embedded containers to help simulate the whole transaction.  It makes for very easy setup, configuration and execution.  Having used these techniques, I could never imagine developing a J2EE app without an embedded container unit test.  The presentations are available at <a href="http://www.innovationontherun.com/presentations/" rel="nofollow">http://www.innovationontherun.com/presentations/</a> and I would be happy to go into more detail if anyone is interested.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html#comment-12362</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Mon, 01 Oct 2007 04:06:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html#comment-12362</guid>
		<description>Nicely written. I agree with it all 100%. I think the hardest part (with hibernate and hsqldb) is getting data in to the db to start with. I've looked at DbUnit a few times but have never ventured into setting it up. It looks like more work than its worth. Although, I must say, the comment above does look simple. Robert, I'm going to give it another whirl. Thanks all.</description>
		<content:encoded><![CDATA[<p>Nicely written. I agree with it all 100%. I think the hardest part (with hibernate and hsqldb) is getting data in to the db to start with. I&#8217;ve looked at DbUnit a few times but have never ventured into setting it up. It looks like more work than its worth. Although, I must say, the comment above does look simple. Robert, I&#8217;m going to give it another whirl. Thanks all.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Murray</title>
		<link>http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html#comment-12331</link>
		<dc:creator>Robert Murray</dc:creator>
		<pubDate>Sun, 30 Sep 2007 15:41:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.buunguyen.net/blog/unit-testing-the-data-access-layer.html#comment-12331</guid>
		<description>You mention DbUnit for data population purposes, but DbUnit also quite capable for results testing also.  Example code below (from the docs) - very easy to code and understand, though setup does require some xml tinkering beforehand.

&lt;pre&gt;// Fetch database data after executing your code
IDataSet databaseDataSet = getConnection().createDataSet();
ITable actualTable = databaseDataSet.getTable("TABLE_NAME");

// Load expected data from an XML dataset
IDataSet expectedDataSet = new FlatXmlDataSet(
                       new File("expectedDataSet.xml"));
ITable expectedTable = expectedDataSet.getTable("TABLE_NAME");

// Assert actual database table match expected table
Assertion.assertEquals(expectedTable, actualTable);
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>You mention DbUnit for data population purposes, but DbUnit also quite capable for results testing also.  Example code below (from the docs) - very easy to code and understand, though setup does require some xml tinkering beforehand.</p>
<pre>// Fetch database data after executing your code
IDataSet databaseDataSet = getConnection().createDataSet();
ITable actualTable = databaseDataSet.getTable("TABLE_NAME");

// Load expected data from an XML dataset
IDataSet expectedDataSet = new FlatXmlDataSet(
                       new File("expectedDataSet.xml"));
ITable expectedTable = expectedDataSet.getTable("TABLE_NAME");

// Assert actual database table match expected table
Assertion.assertEquals(expectedTable, actualTable);
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>
