English 中文(简体)
Where can I find good unit testing resources for EJB and J2EE? [closed]
原标题:

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 9 years ago.

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.

最佳回答
问题回答

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.");
}

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

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

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.





相关问题
run unit tests and coverage in certain python structure

I have some funny noob problem. I try to run unit tests from commandline: H:PROpyEstimator>python src estpython est_power_estimator.py Traceback (most recent call last): File "src est...

How to unit-test an enterprise symfony project?

I´m working on a huge project at my work. We have about 200 database tables, accordingly a huge number of Models, Actions and so on. How should I begin to write tests for this? My biggest problem ...

Code Coverage Tools & Visual Studio 2008 Pro

Just wondering what people are using for code coverage tools when using MS Visual Studio 2008 Pro. We are using the built-in MS test project and unit testing tool (the one that come pre-installed ...

Unit testing. File structure

I have a C++ legacy codebase with 10-15 applications, all sharing several components. While setting up unittests for both shared components and for applications themselves, I was wondering if there ...

Unit Testing .NET 3.5 projects using MStest in VS2010

There s a bug/feature in Visual Studio 2010 where you can t create a unit test project with the 2.0 CLR. https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=483891&wa=...

Unit Test for Exceptions Message

Is there a simple (Attribute-driven) way to have the following test fail on the message of the exception. [TestMethod()] [ExpectedException(typeof(ArgumentException))] public void ExceptionTestTest() ...

热门标签