Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FlatXmlDataSet empty table (DBUnit)

Is it possible to validate that the database has no rows for a specific table with a flat xml structure? Something like:

<dataset>
   <TABLE/>
</dataset

but that isn't working because, I think, it only validates if the 'TABLE' exists..

I'm testing a delete..

like image 270
GregD Avatar asked Jul 02 '26 03:07

GregD


1 Answers

Currently, I have the same issue and I found the workaround. You can set all fields non-Required and your .xml file will be looking like

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE dataset SYSTEM "dbschema.dtd">
<dataset>
    <NameOfYourTable/>
</dataset>

I hope it will help other people.

like image 51
Roman Beskrovnyi Avatar answered Jul 04 '26 17:07

Roman Beskrovnyi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!