Testing the DB layer


How to write Junits for DB layer?

One fundamental concept of TDD is that tests should not be interdependent –how do we apply this for DB, A typical step for DB layer test is –emphasizing am talking about the DB testing:

Test that DB server is up
Test that DB exists
Test that Table exists
Add a record

If the first one fails, all other are bound to fail.

For integration tests we can mock these aspects and get going. For now my tests are interdependent and if one fails all fails –indicating that DB layer is not UP. Am continuing till I get a better solution.

Advertisements

About ChandanPandey

Try to come up with a good design as by product of good coding practices

Posted on August 29, 2010, in TDD and tagged , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: