Kris,
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) daoManager.getDao(UserDao.class);
public UserDaoTest(String testName) {
super(testName);
}
protected IDatabaseConnection getConnection() throws Exception {
log.debug("Creating Connection");
Properties props = Resources.getResourceAsProperties("giveservice/resources/ database.properties");
SimpleDataSource dataSource = new SimpleDataSource(props);
IDatabaseConnection connection = new DatabaseDataSourceConnection(dataSource);
DatabaseConfig config = connection.getConfig();
config.setFeature(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES, true);
return connection;
}
protected IDataSet getDataSet() throws Exception {
log.debug("Read DataSet");
return new XmlDataSet(Resources.getResourceAsStream("dbunit/GST_USERS.xml"));
}
testMothods..... }
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?
Nathan
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: [EMAIL PROTECTED] Blog: http://cafe.jenkster.com/ Wiki: http://wiki.jenkster.com/

