简体   繁体   English

Unitils数据集和修改日期

[英]Unitils dataset and modified dates

Any ideas how this can be done with Unitils dbunit? 有什么想法可以使用Unitils dbunit完成吗? Date relative to current in the DBUnit dataset 相对于DBUnit数据集中的当前日期

The problem is that the [create_date]-placeholder is not recognized in @Dataset. 问题是在@Dataset中无法识别[create_date]占位符。

A simple solution might be to just use placeholders in your xml dataset, eg. 一个简单的解决方案可能是仅在xml数据集中使用占位符,例如。

<?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> <?xml版本='1.0'编码='UTF-8'?> <数据集> <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. 使用Maven时,您可以先执行后处理(在执行任何测试之前,先执行后处理(填写xml-template-dataset中的值,然后将filled-in-xml-dataset复制到正确的文件夹中)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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