dbunit mysql_ant+dbunit 导xml到mysql

Buildfile: E:\heart\workspace\RedAlert_v0.1\build.xml

load:

[echo] 更新数据库中的策划配数数据 到 ${env.TX_CONF_PATH}

[dbunit] Executing operation: REFRESH

[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\Entity.xml

[dbunit] with format:null[dbunit] Executing operation: REFRESH

[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\EntityConsume.xml

[dbunit] with format:null[dbunit] Executing operation: REFRESH

[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\EntityLimit.xml

[dbunit] with format:null[dbunit] Executing operation: REFRESH

[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\Effect.xml

[dbunit] with format:null[dbunit] Executing operation: REFRESH

[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\SysPara.xml

[dbunit] with format:null[dbunit] Executing operation: REFRESH

[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\DropPack.xml

[dbunit] with format:null[dbunit] Executing operation: REFRESH

[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\Item.xml

[dbunit] with format:null[dbunit] Executing operation: REFRESH

[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\Equip.xml

[dbunit] with format:null[dbunit] Executing operation: REFRESH

[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\Army.xml

[dbunit] with format:nullBUILD SUCCESSFUL

Total time:25 seconds

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
可以使用以下步骤将 Dbunit 集成到 Spring Boot 中: 1. 添加依赖项:在 pom.xml 文件中添加以下依赖项。 ```xml <dependency> <groupId>org.dbunit</groupId> <artifactId>dbunit</artifactId> <version>2.5.4</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring-version}</version> <scope>test</scope> </dependency> ``` 2. 创建测试数据集:在 src/test/resources 目录下创建测试数据集。例如,创建名为 `dataset.xml` 的测试数据集。 ```xml <dataset> <table name="users"> <column>id</column> <column>name</column> <column>email</column> <column>age</column> <column>created_at</column> <column>updated_at</column> <row> <value>1</value> <value>test1</value> <value>test1@example.com</value> <value>20</value> <value>2021-01-01 00:00:00</value> <value>2021-01-01 00:00:00</value> </row> <row> <value>2</value> <value>test2</value> <value>test2@example.com</value> <value>30</value> <value>2021-01-01 00:00:00</value> <value>2021-01-01 00:00:00</value> </row> </table> </dataset> ``` 3. 创建测试类:创建名为 `UserRepositoryTest` 的测试类,并添加以下代码。 ```java @RunWith(SpringRunner.class) @SpringBootTest @DatabaseSetup("/dataset.xml") public class UserRepositoryTest { @Autowired private UserRepository userRepository; @Test public void testFindAll() { List<User> users = userRepository.findAll(); assertEquals(2, users.size()); } // other test methods } ``` 4. 运行测试:运行测试类,测试应该能够成功运行。 以上就是整合 Dbunit 到 Spring Boot 的步骤,希望能够对你有所帮助。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值