views:

62

answers:

1

Hi

I am trying to do unit testing of database access layer of my project. But thing is i need to test this layer using apache derby database and during production testing i need to do it on oracle.

So can i use same xml representation of database to do so using dbunit ?

A: 

As I understand you do not have the same environment for development as on production. You are going to create DAL for derby db and replace it by DAL for oracle before going to live (You will be forced to do so if DAL is not primitive). You trying to mitigate risk of migration by creating test suite over this DAL.

In this case the SUT (system under test) will be DAL + DB. You have to test your DAL interface, not DB directly using DbUnit. Insert rows in DB through yours "store" methods and try to load it using "select" methods. Use fresh fixture for each test - restore empty DB before test run. Only such strategy ensures that your DAL interface will be feasible for both oracle and derby.

Yauheni Sivukha
Yes, you understood my problem correctly. I need to test my DAL but problem is that i have different DBs for test and production environment. So how can i tackle this multiple DBs in DAL as queries required will be different for both the cases.
changed
Are you planning to have one single DAL for both databases? How will you handle difference in SQL dialects? How will you create structure update scripts?
Yauheni Sivukha