It's easy to setup a initial status via
@Override protected IDataSet getDataSet() throws Exception { IDataSet data = new FlatXmlDataSetBuilder().build(new File("src/test/resources/my-init1.xml")); return data; }
But if I have a few test cases with under one DBTestCase ? How should I setup multiple initial status (with a few different initial xml files like my-init1.xml, my-init2.xml and my-init3.xml) ?
Thanks in advance !
Hi I think you might looking to make a CompositeDataSet
http://www.dbunit.org/apidocs/org/dbunit/dataset/CompositeDataSet.html
So it probably look something like...
@Override
protected IDataSet getDataSet() throws Exception {
IDataSet[] datasets = new IDataSet[] {
new FlatXmlDataSetBuilder().build(new File("src/test/resources/my-init1.xml")),
new FlatXmlDataSetBuilder().build(new File("src/test/resources/my-init2.xml")),
new FlatXmlDataSetBuilder().build(new File("src/test/resources/my-init3.xml"))
}
return new CompositeDataSet(datasets);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With