Where can I find good unit testing resources for EJB and J2EE? [closed]
Asked Answered
M

5

11

Which online resources, tutorials or books can you recommended to get started with unit testing J2EE / EJB3 applications?

So far I have found ejb3unit, Jakarta Cactus (retired 2011/08) and the Maven Cargo plugin. It would be helpful if there are complete working examples, ready to run.

Target containers are the open source products GlassFish, JBoss and Apache OpenEJB.

Maltose answered 14/11, 2009 at 9:32 Comment(2)
Do you really mean unit testing or integration/functional testing?Wirer
Yes! Both!! The more the merrier ... :)Maltose
M
4

The next version NetBeans 6.8 includes a nice new feature: it generates Unit-Tests for EJB 3.1 with Embeddable Container code.

@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.");
}
Maltose answered 15/11, 2009 at 14:56 Comment(1)
+1 For using the embedded API (and GlassFish!). See blogs.sun.com/alexismp/entry/testing_ejb_3_1_sWirer
S
2

EJB out-of-container testing by Erwann "Airone" Wernli

Shizue answered 18/11, 2009 at 11:30 Comment(0)
M
0

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."

Maltose answered 21/11, 2009 at 6:47 Comment(0)
L
0

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.

Lilialiliaceous answered 24/11, 2009 at 1:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.