java 推荐一个 JPA 单元测试框架
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/452630/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Suggest a JPA Unit test framework
提问by Mohan Narayanaswamy
How to unit test JPA code? is there any way to generate Unit Test case itself?
如何对 JPA 代码进行单元测试?有没有办法自己生成单元测试用例?
Note: I am lazy and new to Unit Test code.
注意:我对单元测试代码很懒惰并且不熟悉。
采纳答案by Adeel Ansari
Check this out, Unitils. Here is a related discussion, with some example codes.
看看这个,Unitils。这是一个相关的讨论,有一些示例代码。
Here is the example, showing DBUnit, Spring and OpenJPAtogether. You might not using all, but this can take you somewhere if you want to go with DBUnit, I believe.
这是示例,将DBUnit、Spring 和 OpenJPA一起显示。您可能不会全部使用,但我相信,如果您想使用DBUnit,这可以带您到某个地方。
回答by Kimble
I'm in the middle of trying out OpenEJB (http://openejb.apache.org/) for my ongoing project. It's an embeddable container with support for EJB 3.0 (and partially 3.1). My first impression of it is fairly good.
我正在为我正在进行的项目试用 OpenEJB ( http://openejb.apache.org/)。它是一个可嵌入的容器,支持 EJB 3.0(和部分 3.1)。我对它的第一印象相当不错。

