Differences between revisions 4 and 5
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
  * Don't forget to add the DTD declaration to the top of your XML file: `<!DOCTYPE dataset SYSTEM "testdata/test.dtd">` Unfortunately, DbUnit interprets this path from the location of execution, while the XML validator of MyEclipse interprets the path relative to the location of the XML file.

[http://www.dbunit.org/ DbUnit] is a very handy tool for inserting test data into your database or confirming data after your tests. Sometimes, however, you run into gotchas.

    public void testExportDtd() throws Exception {
        IDatabaseConnection connection = getConnection();
        FlatDtdDataSet.write(connection.createDataSet(),
                new FileOutputStream(XML_DATASET_ROOT+"test.dtd"));
    }
  • Don't forget to add the DTD declaration to the top of your XML file: <!DOCTYPE dataset SYSTEM "testdata/test.dtd"> Unfortunately, DbUnit interprets this path from the location of execution, while the XML validator of MyEclipse interprets the path relative to the location of the XML file.

iDIAcomputing: DbUnit (last edited 2009-07-27 18:25:53 by localhost)