zhou.sir 发表于 2022-4-21 13:17:12

后端如何进行数据库单元测试

请问下后端如何对数据库操作进行单元测试调试,一定要整个工程启动,idea远程测试接口才行吗?
比如我就是想简单的测试下数据库查询,不想启动整个工程,感觉太慢了。有没有哥们整过的。求指导

try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
   Business business = new Business(emc);
   String mobile = "xxxxxxx";
   String personId = business.person().getWithCredential(mobile);
   Person person = emc.find(personId, Person.class);

} catch (Exception e) {
   e.printStackTrace();
}


这是报错 java.lang.Exception: get EntityManagerContainerFactory instance error, not initial.

启蒙星 发表于 2022-4-22 10:13:44

这是平台后续要改进的方向

zhou.sir 发表于 2022-4-22 10:53:56

启蒙星 发表于 2022-4-22 10:13
这是平台后续要改进的方向

:handshake 加油

论坛管理员 发表于 2022-4-24 09:49:44

:)
页: [1]
查看完整版本: 后端如何进行数据库单元测试