Getting Started Guide
There is a "Getting Started Guide" on the JSFUnit web site. Click Here
The hardest part about using JSFUnit is preparing your WAR. You have to add several jar files, plus you need to add a few Filter and Servlet declarations in web.xml.
However, if you are using JBoss AS 5, you will want to see JSFUnitWithASMicrocontainer, which tells about the JSFUnit deployer. This is by far the easiest way to use JSFUnit because it does not require any WAR change to run your test. With this deployer, everything JSFUnit needs is added on the fly without modification to the WAR.
If you are using a Servlet 3.0 container such as JBoss AS 6, you will want to look at Using JSFUnit with Servlet 3.0 to ease configuration and make use of the JSFUnit Console.
About the Getting Started Demo
From this page, you can download a fully-functioning WAR that shows the proper JSFUnit packaging for several different servlet containers. This is one of several WAR files that we use to test JSFUnit itself. Once you start the application, you interact with a simple "Hello World" JSF application. You will also see links to execute tests against the running application. This demonstrates running JSFUnit tests from the browser. But these tests can also be run from JSFUnitWithAnt or JSFUnitWithMaven or RunningJSFUnit that JUnit is capable of kicking off a test.
For older servlet containers (Tomcat 5, Jetty 5, etc.)
Once deployed, click http://localhost:8080/hellojsfTomcat5 to run the JSFUnit demo.
For non-JEE servlet containers that support JSP 2.1 (Tomcat 6, Jetty 6, etc.)
Once deployed, click http://localhost:8080/hellojsfTomcat6 to run the JSFUnit demo.
For JEE 5 containers such as JBoss AS 4.2 and Glassfish
hellojsfJEE5.war works for JBoss 4.2.x and most other JEE 5 compliant servers.
Once deployed, click http://localhost:8080/hellojsfJEE5 to run the JSFUnit demo.
For JBoss AS 5.x and AS 6.x
hellojsfJBoss5.warhellojsfJBoss5.war works for JBoss AS 5.x and AS 6.x. The difference between this war and the regular JEE5 war is that it leaves out xercesImpl.jar and xalan.jar. These two jars can cause conflicts with the built-in versions included in JBoss AS 5 and AS 6.
Once deployed, click http://localhost:8080/hellojsfJBoss5 to run the JSFUnit demo.
Source Code for the WAR files
Most of the source is included in the WAR, including the test source, .jsp files, and of course, the web.xml. So you should be able to get a good idea of how to package a JSFUnit WAR from looking at these examples. The source for managed beans is included in the additionalSource.zip below. If you have any questions, feel free to ask in the JSFUnit Forum.