1

I use IDataSet to read from a XML file and write to my database so I can run the Junit test against my database. problem is my senario is becoming to complicated and I need to change the data in the database in middle of test.

I was looking for a way to change the IDataSet data without reading from XML file and write to database, this way I don't have to create couple of huge XML files just to change one row!

my code currently is something like this

IDataSet dataSet  = new XmlDataSet(fileStream);
DatabaseOperation.CLEAN_INSERT.execute(jdbcConnection, dataSet);

thanks a lot in advance

2 Answers2

2

I'm going to try

ReplacementDataSet rds = new ReplacementDataSet(ds);

rds.addReplacementObject(John, Tom );

I guess if a fields be unique it's going to work!

0

Usually, having the need to change data in the middle of a test implies that test is actually more than one test; the next test starting at the needed-data-change point.

Try splitting the test at that "data change" point into a second one. Load multiple XML files into the database for each test - a common data "shared" file and then a separate XML file for each test specific data. In your example above, create a "...huge XML file" of the common data and then two separate XML files each containing the one different row for each test.

Jeff
  • 956
  • 8
  • 10