0

I have to clone tables from an existing database somehow in order to run unit tests. The ideal solution would be something - a Maven plugin or Spring bean - that would clone the database tables into a HSQL database, which I could then hit with my JUnit tests.

What is the most straightforward way to do this?

4

1 回答 1

3

下载 DBUnit。http://dbunit.sourceforge.net/

将数据集从现有数据库导出到 XML。

在您的套件中,将数据集导入 HSQL。

如果您打算对一个行为与其持久层紧密耦合的应用程序进行单元测试(例如,任何用 ORM 编写的东西),您就会想了解 DBUnit。

于 2013-07-12T21:48:43.570 回答