PDA

View Full Version : dao test


kamilski81
Aug 13th, 2007, 02:03 AM
Hey guys,
I want to test a dao class but what I am reading doesn't make sense. I have read that a dao unit test should not interact with a third party, interactions should be left for integration testing.

In my case, my dao is accessing a Sybase database. I have read the spring documetation online and actually picked up a Spring book but the question still remains. Would someone mind pointing me to some 1) dao unit & integration testing examples, 2) dao testing examples that commit the transaction.

thank you in advance.

noon
Aug 13th, 2007, 04:57 AM
Hey guys,
I want to test a dao class but what I am reading doesn't make sense. I have read that a dao unit test should not interact with a third party, interactions should be left for integration testing.

In my case, my dao is accessing a Sybase database. I have read the spring documetation online and actually picked up a Spring book but the question still remains. Would someone mind pointing me to some 1) dao unit & integration testing examples, 2) dao testing examples that commit the transaction.

thank you in advance.

What is your DAO layer based on? Hibernate?

karldmoore
Aug 13th, 2007, 08:12 AM
Have you got a reference to the information you are referring to?

kamilski81
Aug 13th, 2007, 11:28 AM
I am using hibernate. I do have reference to the code but it is proprietary data, and I cannot post it. However, it looks a little something like the following :

public class DaoTest extends SpringHibernateTest extends AbstractTransactionalDataSourceSpringContextTests {
private Dao;

public Daotest() {
super(new String[] {"springContext.xml"};
}

public void testDaoMethod() {
...test code....
dao.testDaoMethod(arg1, arg2, arg3);
}

}