January 23, 2004More DBUnit woesBy an interesting coincidence, DBUnit released version 2.0 yesterday, so I immediately installed it. The good news is that it didn't require any change in my code (probably because I am still in the early experimentation stage at this point, but I understand that some major configuration changes have been made). That being said, my first contact with version 2.0 is not good at all. For example, I made a typo in my XML dataset and misspelled a column name: <PERSON last_nam = "Molinier" first_name = "David" middle_name = "L" /> With DBUnit 1.5.6, the punishment is immediate: java.sql.SQLException: General error, message from server: "Column 'last_name' cannot be null" (Note that the error is not that the column name is incorrect, which is already not looking good). But with DBUnit 2.0, the error is silently discarded and I end up with an inconsistent database: +-----------+------------+-------------+ Second, I can't seem to be able to initialize the middle_name column, neither with 1.5.6 nor with 2.0. No error message, no indication whatsoever of what went wrong. Of course, I am pretty confident the spelling is right. Strike three for DBUnit. Very disappointed. Posted by cedric at January 23, 2004 04:30 PM Comments
Cedric, I've been using DBUnit for 2 years W/O any problem. May be you just don't cook it right? Posted by: Slava Imeshev at January 23, 2004 05:33 PMYou might not have setup the schema DTD for the data correctly or at all. This would be the result if this is the case. Posted by: David Channon at January 25, 2004 02:25 PM1. "last_name" problem: 2. "middle_name" problem: You should have got a warning about the unrecognized data type. Perhaps the warning was lost in the middle of a very verbose output! Maybe it should be an error instead of a warning! I agree that populating data in a separate file sounds good, but my experience has been that it's just another thing to keep track of. That said, I use the assertEqual() capability a lot and find it very useful. After all ,who wants to write all that rote ResultSet traversal code? All in all, I find DBUnit very useful and like having it in my bag of tricks. Kudos to Manuel for continuing to improve it. Posted by: Rich Youngkin at January 30, 2004 03:03 PMI found a possible answer to your question #2. Example:
Hope this helps... Posted by: Karim at July 20, 2005 04:55 PMI found a possible answer to your question #2. Example: In the above example "column2" will not get populated. It seems like the table metadata gets set up for the first entry DbUnit encounters. If you change the ordering then you will start to see "column2" getting populated. Hope this helps... Posted by: Karim at July 20, 2005 04:56 PMhey try this Post a comment
|