The JSFUnit Beta 3 release has some important new features.
facade and richfaces packages deprecated. Scheduled for removal in GA
JSFUnit has changed the underlying client-side technology from HttpUnit to HtmlUnit. This change facilitates much better AJAX testing support and support of a wider variety of tag libraries instead of just RichFaces. Therefore, the following two packages are deprecated:
org.jboss.jsfunit.facade is replaced by org.jboss.jsfunit.jsfsession
org.jboss.jsfunit.richfaces is replaced by org.jboss.jsfunit.richclient
Your tests written with the old packages will continue to work. However, you will need to migrate to the new packages before the GA release of JSFUnit when they will be removed.
The JSFClientSessionAPI wiki page will have more details on the new API, but the main change is that you will now start JSFUnit test code like this:
JSFSession jsfSession = new JSFSession("/index.jsf"); JSFClientSession jsfClient = jsfSession.getJSFClientSession(); JSFServerSession jsfServer = jsfSession.getJSFServerSession();
Also, see the JSFUnit blog for more details on why we made this important change.
Use the HtmlUnit API as freely as you like
With HttpUnit, it was awkward to "break out" of JSFUnit and use this API directly. Now with HtmlUnit, as long as you start your initial request with a JSFSession object, you can mix and match calls to JSFClientSession and HtmlUnit.
web.xml declaration has changed slightly
Instead of using the Cactus servlet redirector, you should use one provided by JSFUnit. The JSFUnitServletRedirector manages memory better:
<servlet> <servlet-name>ServletRedirector</servlet-name> <servlet-class>org.jboss.jsfunit.framework.JSFUnitServletRedirector</servlet-class> </servlet>
JBoss Seam support is built in to JSFUnit core
JSFUnit will now detect if Seam is initialized and then allow access to conversation-scoped managed beans.
Therefore, you will no longer need to add the jsfunit-seam jar to your project and you will no longer need to use the SeamClient class. If you were using the SeamClient.clickSLink() API call then you should use the new JSFClientSession.click() method instead.
New support for pluggable client-side authentication.
JSFUnit now allows you to write reusable login modules for logging into your application. It also provides standard login modules for BASIC and FORM authentication. See JSFUnitTestingSecurePages for details.
Other new features for Beta 3
Support for emulating different browser types and browser versions. See JSFSessionAPI.
You can add client-side request listeners that let your test take action before and after any http request, including those made by AJAX components. See JSFSessionAPI.
The new RichFacesClient in the new org.jboss.jsfunit.richclient package has a helper API for some new RichFaces components. Some of the helper APIs that were in the old RichFacesClient have not been ported to HtmlUnit yet. This is scheduled to be completed before GA, but you can always use plain HtmlUnit for testing these components.