FacesTester 0.1 Released

April 1st, 2009

About a month ago, I announced a new project, FacesTester, a JUnit-based testing tool for JSF that my good friend Rod Coffin and I have undertaken. Since then, Rod posted a very nice introduction to FacesTester usage. Today, we made our first official release, FacesTester 0.1. The version number should indicate that it’s still a work in progress, but it is already quite functional (I, for one, have been using it to build a test suite for Mojarra Scales, which has helped drive out features and resolve bugs very quickly). We wanted to push out a release to encourage people to download it, use it, and give us feedback.

So what does FacesTester currently support? Quite a bit. In this entry, we’ll take a quick look at what FacesTester offers, and what we have planned.

Without diving into code too much, which Rod has covered nicely, here’s a quick list of what we support:

  • Requesting a page from your JSF app
  • Verifying the existence of a component in the UIComponent tree of a rendered page
  • Verifying the existence of arbitrary substrings in the rendered page
  • Exercising managed beans via EL on a requested page
  • Exercising custom components via a requested page
  • Acquiring a handle (FacesForm) for a form on a rendered page
  • Manipulating form values and submitting the form
  • Validating managed-bean declarations in faces-config.xml
  • Validating custom component declarations in faces-config.xml

While that is, I think, a pretty nice set of features, we have more work planned. For example, the faces-config.xml static analysis will eventually cover as many of the valid configuration elements as possible (e.g., Renderer declarations, navigation cases, PhaseListeners, etc); we currently do not support query string parameters, which I’ll be fixing shortly; and so on.

If you’re a JSF developer, we’d love for you try this out and tell us what works, what doesn’t, and what you’d like to see. The project is hosted on kenai.com, where we have forums and, most importantly, an issue tracker. You can download the jar file directly from the Kenai project site, or, if you’re a Maven user, the jar is available from the java.net Maven 2 repository:

        <dependency>
            <groupId>com.steeplesoft.jsf</groupId>
            <artifactId>facestester</artifactId>
            <version>0.1</version>
            <scope>test</scope>
        </dependency>

Any and all feedback is welcome!

Popularity: 8% [?]

5 Comments

  1. man4j says

    When this tool will be support JSF 2.0? Thanks.

    April 2nd, 2009 | #

  2. Hobi says

    Jason:
    How would you compare FacesTester with Selenium (http://seleniumhq.org)? Of course, I never used any JSF unit testing API and I am looking for one to test my current JSF app. I wrote my own LoggingPhaseListener implements PhaseListener to test lifecycle but dont know to proper way to test a JSF app.
    Please advise.
    Hobi

    April 8th, 2009 | #

  3. Jason Lee says

    man4j,

    I really don’t know for sure, to be honest. As far as I know, it should run as is under JSF 2, since JSF 2 is backward compatible, but it may be difficult to test some of the new JSF 2 features. Or not. I haven’t tested it yet, but since we’re really close to releasing JSF 2, I imagine that testing will come sooner, rather than later.

    April 9th, 2009 | #

  4. Jason Lee says

    Hobi,

    I’ve not used selenium, but it looks to like it’s a tool for driving a web browser to test an application that is deployed to a server. FacesTester, on the other, does not require a server. For a simple example of requesting a form, changing it’s data, submitting it back and testing the results, you can look at this Mojarra Scales test: https://kenai.com/hg/scales~mercurial/file/tip/demo/src/test/java/com/sun/mojarra/scales/test/DateSelectorTest.java

    April 9th, 2009 | #

  5. Dan Allen says

    I can verify that this tool supports JSF 2. It also supports a Web Beans / JCDI environment as I just create some tests for the Seam 3 example I am working on. I should have the tests checked in in a few days for you to check them out. Nice work Jason!

    May 6th, 2009 | #

Sorry, the comment form is closed at this time.

With many thanks to Kaushal Sheth
`