简体   繁体   中英

Unitils dataset and modified dates

Any ideas how this can be done with Unitils dbunit? Date relative to current in the DBUnit dataset

The problem is that the [create_date]-placeholder is not recognized in @Dataset.

A simple solution might be to just use placeholders in your xml dataset, eg.

<?xml version='1.0' encoding='UTF-8'?> <dataset> <user userName="jdoe" name="doe" firstname="john" lastLogin="{YESTERDAY}" /> <user userName="jdoe" name="doe" firstname="jane" lastLogin="{A_WEEK_AGO}" /> </dataset>

and do some post-processing(replace the placeholders with the calculated values) before you run your tests. When you are using Maven, you could then first execute the post-processing, (fill in the values in the xml-template-dataset, copy the filled-in-xml-dataset to the correct folder), before any tests are executed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM