After a lot of changes and a long delay, I’m pleased to announce that we have released FacesTester 0.3 tonight. This version has a large number of new features. Read on the for details.
This release has three major changes: removal of almost all external dependencies, support for Servlet filters and listeners, and support for JSF 2.
External Dependencies
From the start, we have always depended on Spring Mock/Test to provide the Servlet API classes. While this works, it poses a couple of problems. For non-Maven users, gathering and managing the various required jar files can be tedious. While manageable, it’s nice not to have to do that. Another big issue is the “build from source” requirement on GlassFish technologies. As we looked into using FacesTester on Mojarra, this requirement became increasingly important, so the removal of external dependencies, where possible and reasonable, became a high priority.
Servlet Filters and Listeners Support
When I talked to Stan Silvert about his JSFUnit project, one of the things he lamented about other testing solutions is that they usually don’t exercise the Filters and Listeners a web app might have, so the testing, he says, is incomplete. That made good sense to me, so we added support for these two Servlet APIs to FacesTester. If there are filters or listeners configured in the application’s web.xml, they will be called automatically — no special steps required.
JSF 2 Support
With this release, we now support running in a JSF 2 environment, with full access to all annotation-based objects the new spec makes available. I should be a bit more precise here, in that when I say “JSF 2,” I mean Mojarra 2, primarily as it’s the only JSF 2 implementation available. To use FacesTester with JSF 2, you will need one extra jar, which includes the Mojarra2-specific bits:
<dependency>
<groupId>com.steeplesoft.jsf</groupId>
<artifactId>facestester-jsf2</artifactId>
<version>0.3</version>
<scope>test</scope>
</dependency>
On that note, after a good discussion with Matthias Wessendorf of MyFaces fame at JavaOne back in June, we did some restructuring of the code in FacesTester that will make it easier to add support for other implementations. Currently, there’s a small bit of Mojarra-specific code that’s used internally to bootstrap the JSF environment. In theory, equivalent functionality can be written, where needed, to make sure MyFaces bootstraps correctly, with no need for the Mojarra jars on the classpath. It may be that MyFaces is supported now out of the box, but I haven’t had the chance to test that. If there are any interested MyFaces users, we’d appreciate the contribution. If not, we’ll try to get to it eventually.
Licensing was also addressed in this release. At the request of Matthias, and after some internal discussions, we’ve relicensed the project (or, more correctly, added an explicit license) under the BSD license, which should make all but the most license zealous users happy.
There were also many bugs fixed and other minor improvements. I should note that we’ve gotten a lot of additional help from Imre Osswald, Ryan Lubke, Ingo Hofmann and Guy Veraghtert.
I’m pretty happy with the progress we made on this release, but there’s much left to be done, so if you’re interested in helping, now’s as good a time as any. ![]()
Popularity: 4% [?]
Up 
HI Jason I want to use your JSF Testing framework
But I have some problem to use it.
Indeed My framework work with JSF 1.1 (I have a lot of developpers
and a lot of apps)
so migration is not booked
Can you tell me which version of Facestester is compliant with which JSF version
thanks in advance
To be honest, I haven’t done any work with JSF 1.1 in a long time. Let me see if I can make FacesTester work with 1.1, but my fear is that it won’t, due to use of 1.2 APIs. If that turns out the be the case, that can be fixed, of course, but that takes time. I’ll see what I can figure out.
Hi Jason Thanks for your answer
I try to use it with JSF 1.2_02 and facestester 0.2
I got this error
java.lang.NoSuchFieldError: ExpressionFactory
at com.steeplesoft.jsf.facestester.servlet.ServletContextFactory.createContextForWebAppAt(ServletContextFactory.java:42)
at com.steeplesoft.jsf.facestester.servlet.ServletContextFactory.createServletContext(ServletContextFactory.java:29)
at com.steeplesoft.jsf.facestester.FacesTester.(FacesTester.java:48)
at testJSF.setUp(testJSF.java:12)
Then I tried To use it with JSF 1.2_13 and facestester 0.2
javax.faces.FacesException: java.lang.IllegalArgumentException: MockRequestDispatcher requires MockHttpServletResponse
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:128)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at com.steeplesoft.jsf.facestester.FacesLifecycleImpl.render(FacesLifecycleImpl.java:23)
at com.steeplesoft.jsf.facestester.FacesTester.requestPage(FacesTester.java:90)
at testJSF.test1(testJSF.java:20)
So I need some helps ..