Help

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Yes, Seam provides its own integration test framework based on TestNG. You can easily mock all Seam services using those facilities without ever loading an application server or a database. Refer to the testexample ANT target in the Seam booking example application for more details. Note that many other bundled Seam examples also contain unit tests, which you can use as a template.

One other point to keep in mind is that just about every built-in Seam component can be overridden. This allows you to modify Seam's behavior in a test environment, perhaps to sever its functionality from runtime dependencies.

When Seam looks for a component instance, it keys on the name of the component with the highest priority. So if your code calls on a component that has a dependency on a runtime context such as the servlet or JSF context, you can simply create a debug component and stub out the method bodies instead of having to use a mocking framework such as EasyMock. Here is an example of the definition of the Conversation component:

@Name("org.jboss.seam.core.conversation")
@Install(debug = true, precedence = Install.MOCK)
@BypassInterceptors
public class MockConversation extends Conversation {
  // override methods you want to simplify
}