ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Maves <Nathan.Ma...@Sun.COM>
Subject Re: Dao unit testing?
Date Thu, 10 Feb 2005 16:44:19 GMT

I am really close to getting everything to work with dbunit.   
Everything works fine from an Ant task. I created my first Junit test  
and this is where the trouble started.

public class UserDaoTest extends DatabaseTestCase {
     private static Log log = LogFactory.getLog(UserDaoTest.class);
     private DaoManager daoManager = DaoConfig.getDaomanager();
     private UserDao userDao = (UserDao)  
     public UserDaoTest(String testName) {

     protected IDatabaseConnection getConnection() throws Exception {
         log.debug("Creating Connection");
         Properties props =  
         SimpleDataSource dataSource = new SimpleDataSource(props);
         IDatabaseConnection connection = new  
         DatabaseConfig config = connection.getConfig();
         return connection;

     protected IDataSet getDataSet() throws Exception {
         log.debug("Read DataSet");
         return new  


Everything runs fine but I can never see the data that should get  
inserted into the db.  Hence all of my test fail!

Does everything look ok to you?

Can you send me any example that is like this?


On Feb 10, 2005, at 8:56 AM, Kris Jenkins wrote:

> Nathan Maves wrote:
>> I have been trying for two day to get DBunit to work with only  
>> partial success.  The support for this project is nonexistent.   
>> Anyone know of a more supported project or have any experience with  
>> this one?  How do most of you test your database layer?
> I use DBunit, and I'm happy with it.  Have you seen this onjava  
> article?
>    http://www.onjava.com/pub/a/onjava/2004/01/21/dbunit.html
> It got me started pretty quickly.  I could send you some sample files  
> from one of my projects if you like, but you'll find that that article  
> is much better documented. :-)
> Hope that helps,
> Kris
> -- 
> Kris Jenkins
> Email:  kris@jenkster.com
> Blog:   http://cafe.jenkster.com/
> Wiki:   http://wiki.jenkster.com/

View raw message