@Test
public void testHello() throws Exception {
System.out.println("hello");
HelloService instance = (HelloService)javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/HelloService");
String expResult = "";
String result = instance.hello();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
@Test
public void testHello() throws Exception {
System.out.println("hello");
HelloService instance = (HelloService)javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/HelloService");
String expResult = "";
String result = instance.hello();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
JSFUnit is "a test framework for JSF applications. It is designed to allow complete integration testing and unit testing of JSF applications using a simplified API. JSFUnit tests run inside the container, which provides the developer full access to managed beans, the FacesContext, EL Expressions, and the internal JSF component tree. At the same time, you also have access to parsed HTML output of each client request."
发布评论
评论(5)
使用 Eclipse 和 OpenEJB 进行 EJB 单元测试
测试 EJB 的文章
Glassfish EJB 3.0 单元测试
JUnitEE 教程
使用 OpenEJB 进行有效的单元测试 EJB 3.0
JUnitEE IBM 教程
EJB Unit Testing with Eclipse and OpenEJB
Article on Testing EJB
Glassfish EJB 3.0 Unit testing
JUnitEE Tutorial
Effective Unit Testing EJB 3.0 with OpenEJB
JUnitEE IBM Tutorial
下一版本的 NetBeans 6.8 包含一个不错的新功能:它 为 EJB 生成单元测试3.1 使用可嵌入容器代码。
The next version NetBeans 6.8 includes a nice new feature: it generates Unit-Tests for EJB 3.1 with Embeddable Container code.
EJB 容器外测试 作者:Erwann "Airone" Wernli
EJB out-of-container testing by Erwann "Airone" Wernli
JSFUnit 是“JSF 应用程序的测试框架。它旨在允许完整的集成测试和单元测试使用简化的 API 的 JSFUnit 测试在容器内运行,这为开发人员提供了对托管 bean、FacesContext、EL 表达式和内部 JSF 组件树的完全访问权限。同时,您还可以访问已解析的 HTML。每个客户端请求的输出。”
JSFUnit is "a test framework for JSF applications. It is designed to allow complete integration testing and unit testing of JSF applications using a simplified API. JSFUnit tests run inside the container, which provides the developer full access to managed beans, the FacesContext, EL Expressions, and the internal JSF component tree. At the same time, you also have access to parsed HTML output of each client request."
有一本关于 TDD 的好书,作者是 Lasse Koskela
它有一个基于 EJB 测试。抓住它并卷起袖子加油吧。
There is nice book on TDD written by Lasse Koskela
It has a free to download web extra based on EJB testing.Grab it and roll up your sleeves.